Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 DateTime Problem

Author  Topic 

acko
Yak Posting Veteran

52 Posts

Posted - 2003-08-19 : 11:29:39
I cannot insert datetime value in sqlserver table from vb
I use datapicker control
Here is code

Dim cn As ADODB.Connection

Set cn = New ADODB.Connection

cn.Provider = "SqlOledb"
cn.Properties("User ID") = "sa"
cn.Properties("Password") = "password"
cn.Properties("Initial Catalog") = "NorthWind"
cn.Properties("Data Source") = "AckoB"

cn.Open
I tryed the following and nothing is working
cn.Execute "Insert datum values Datum (#" & dt.Value & "#)"
cn.Execute "Insert datum values Datum (" & dt.Value & ")"
cn.Execute "Insert datum values Datum (" & dt.Value & ")"
thanks
Alex

nr
SQLTeam MVY

12543 Posts

Posted - 2003-08-19 : 11:37:06
try
cn.Execute "Insert datum values ('" & format(dt.Value,"YYYYMMDD") & "')"


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

acko
Yak Posting Veteran

52 Posts

Posted - 2003-08-19 : 11:47:24
Thanks very much
Alexandar
Go to Top of Page
   

- Advertisement -