Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Field

Status
Not open for further replies.

binjovi

Programmer
Sep 10, 2001
49
CA

Hi guys,

Thanks for the help you will giving me
Guys I have a problem in putting the data from Visual basic to sql sever db.

My application is on VB and backend is sql server.I am using adodb connection and sql in the project . when i want to insert record I am wrting an insert statement. when i execute the statement it puts value for all the columns but for the date field is shows an error

can you suggest me how to put datefields in the sql statement, whether you have to put single quotes,double quotes or # symbol with a small example

my statement goes somewhat like this
mysql="insert into emp values ("&var1&","&var2&",now the datefield to be put"

Regards
bins
 
You use single quotes. I have found problems getting a date from VB to SQL Server. In the past I have had to pass it as a varchar and then Convert to datetime in SQL Server. You might mess around with that and see if it works for you. Check in BOL for Convert. You might try using Convert in your SQL statement. That should pass it in correctly.

Hope this helps....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top