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
 Other Development Tools
 ASP to SQL 2000 timestamp

Author  Topic 

BCJim
Starting Member

2 Posts

Posted - 2003-10-11 : 14:09:55
I have a web-based form that is submitting to a SQL 2000 DB which has a smalldatetime field with a default value of GetDate() that generates an auto timestamp perfectly within Enterprise Manager with a new record insert.
Problem is the online ASP form throws a 80040e07 error, Syntax error converting character string to smalldatetime data type.

Question is - how to modify the ASP form or the DB to generate the "timestamp" for each record insert?

Be nice, I'm new to SQL2000

SamC
White Water Yakist

3467 Posts

Posted - 2003-10-11 : 15:16:34
What you are trying to do has been done many times.

It's hard to evaluate what you may be doing wrong unless you post your ASP code that is calling SQL. You might be using ADO, or you might be coding your SQL string yourself. If you're using ADO, the the adDATE parameter might be in question. If you're coding your own SQL string then - Have you printed out this string to see what it looks like?

Could you post your code and any stored procedure (if you're calling a stored procedure?)

Sam
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2003-10-11 : 15:23:49
Insert the record via an SP. When the sp performs the insert omit the datetime field and it will be applied automatically.

It's always a good idea to make all database access via stored procs as it's more efficient and easier to develop and maintain. You don't have the dificulties about find where the problems lie as you can just trace the SP calls and run them in query analyser and see the response.

==========================================
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

BCJim
Starting Member

2 Posts

Posted - 2003-10-11 : 22:10:29
OK, I'll go with the SP approach rather than messing with ASP and ADO. Thanks guys.

Be nice, I'm new to SQL2000
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2003-10-12 : 00:53:53
See
http://www.nigelrivett.net/DBAccess.inc.html

==========================================
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
   

- Advertisement -