G
Guest
Hello
I am trying to push the data from my datatable to my database. However i keep getting an error stating
Error converting data type char to datetime
Here is my code
daClient.InsertCommand.Parameters.Add("@RoomID", SqlDbType.Char, 5, "RoomID"
daClient.InsertCommand.Parameters.Add("@RoomDt", SqlDbType.Char, 50, "RoomDt"
daClient.InsertCommand.Parameters.Add("@Req_Session", SqlDbType.Char, 1, Req_Session"
daClient.InsertCommand.Parameters.Add("@Req_Layout", SqlDbType.Char,
50, "Req_Layout"
daClient.InsertCommand.Parameters.Add("@Guests", SqlDbType.Char, 4, "No_Of_Guests"
The RoomDt column is stored as a datetime column in my databas
and the No_Of_Guests column is stored as an Int(4) column in my database
when i tried to change the RoomDt datatype above to:
daClient.InsertCommand.Parameters.Add("@RoomDt", DateTime, "RoomDt"
i still get an error message that says
An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dl
Additional information: Cast from string "RoomDt" to type 'Integer' is not valid
I am trying to push the data from my datatable to my database. However i keep getting an error stating
Error converting data type char to datetime
Here is my code
daClient.InsertCommand.Parameters.Add("@RoomID", SqlDbType.Char, 5, "RoomID"
daClient.InsertCommand.Parameters.Add("@RoomDt", SqlDbType.Char, 50, "RoomDt"
daClient.InsertCommand.Parameters.Add("@Req_Session", SqlDbType.Char, 1, Req_Session"
daClient.InsertCommand.Parameters.Add("@Req_Layout", SqlDbType.Char,
50, "Req_Layout"
daClient.InsertCommand.Parameters.Add("@Guests", SqlDbType.Char, 4, "No_Of_Guests"
The RoomDt column is stored as a datetime column in my databas
and the No_Of_Guests column is stored as an Int(4) column in my database
when i tried to change the RoomDt datatype above to:
daClient.InsertCommand.Parameters.Add("@RoomDt", DateTime, "RoomDt"
i still get an error message that says
An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dl
Additional information: Cast from string "RoomDt" to type 'Integer' is not valid