473,320 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

####Datatype error

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_Sessio n", 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

Jul 21 '05 #1
0 1188

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stephen Briley | last post by:
For some reason, my posts are scrubbed as attachments. Lets hope that sending from the yahoo account works. I'm new to Python and I'm trying to do some database work with MS Access, but I can't...
2
by: Steve Briley | last post by:
I'm new to Python and I'm trying to do some database work with MS Access, but I can't seem to get around a "datatype mismatch error".  Here's an example table that I'm working with... ...
4
by: J.C. Flores | last post by:
Hello all, First of all, I must state that I'm new to SQL Server, but have been a long-time software guy for quite some time. Please excuse the potential simplicity of the solution to my...
1
by: al | last post by:
hi, I have a table that contain a field "amount" its datatype is numeric(18,4) in sql server 2000 I have created a Datagrid, when I edit a record, I get an error like this one BC30456:...
2
by: Johan Delimon | last post by:
"The active directory datatype cannot be converted to/from a native DS datatype" I have an ASP.NET web page that uses queries to AD to identify current users. Delegation is configured in AD and...
1
by: Prabu Subroto | last post by:
Dear my friends... I want to change the datatype of a completed table (has had already content). But I don't know how. Here is my try: " kv=# alter table customer alter column address set...
1
by: Praveen | last post by:
HI, I have a table with IDENTITY column with the datatype as INTEGER. Now this table record count is almost reaching its limt. that is total record count is almost near to 2^31-1. It will reach...
0
by: vijayalakshmi.venkataraman | last post by:
Hello, I have a .NET client that accesses a Java webservice. Let me first say that the client stub I got generated from the wsdl was incomplete and had to make changes to it manually to make it...
1
by: Jay Balapa | last post by:
Hello, Iam trying to do the following- if(myColumn.DataType==typeof(bool)) { } this does not work either Type.GetType("System.Boolean") instead of typeof(bool).
1
by: reliance | last post by:
Using Oracle Migration Workbench, I migrated ms-access 2003 database to oracle 9i. The memo datatype in ms-access mapped to clob datatype in oracle. I have created a system dsn to access oracle...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.