DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 25 Jul 2007 22:44:17 -0400,    posted on: microsoft.public.dotnet.languages.vb.data        back       

Thread Index
  1    Tony M
          2    Paul Clement
          3    Michel Posseth [MCP]


Pass date as parameter to Access DB   
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
Date:Wed, 25 Jul 2007 22:44:17 -0400   Author:  

Re: Pass date as parameter to Access DB   
On Wed, 25 Jul 2007 22:44:17 -0400, "Tony M"  wrote:

 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
~~~~
Microsoft MVP (Visual Basic)
Date:Thu, 26 Jul 2007 11:18:02 -0500   Author:  

Re: Pass date as parameter to Access DB   
I addition to Paul`s response

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



"Tony M"  schreef in bericht 
news:%23Os0i7yzHHA.5052@TK2MSFTNGP04.phx.gbl...

> 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
>
> 
Date:Thu, 26 Jul 2007 18:38:30 +0200   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us