Groups | Blog | Home
all groups > vb.net data > july 2007 >

vb.net data : Pass date as parameter to Access DB


Tony M
7/25/2007 10:44:17 PM
ASP .net - webforms

I changing things from sql string concatenation to parameters, for sql
injection reasons.

I keep getting a data type mismatch error.

I know the field / column is date/time and it worked with the string
concatenation .

OleCmd.Parameters.AddWithValue("LastChangeTime", Now)



Can someone tell me how to pass a date (Now)?



Thanks

Paul Clement
7/26/2007 11:18:02 AM
[quoted text, click to view]

¤ ASP .net - webforms
¤
¤ I changing things from sql string concatenation to parameters, for sql
¤ injection reasons.
¤
¤ I keep getting a data type mismatch error.
¤
¤ I know the field / column is date/time and it worked with the string
¤ concatenation .
¤
¤ OleCmd.Parameters.AddWithValue("LastChangeTime", Now)
¤
¤
¤
¤ Can someone tell me how to pass a date (Now)?

You probably need to specify the data type of the parameter:

System.Data.OleDb.OleDbType.Date


Paul
~~~~
Michel Posseth [MCP]
7/26/2007 6:38:30 PM


I addition to Paul`s response

it is also possible to pass the date as a string ( i prefer ISO 8601 )



"Tony M" <TonyMast_NOSPAM@msn.com> schreef in bericht
news:%23Os0i7yzHHA.5052@TK2MSFTNGP04.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button