Print Page | Close Window

parameterized queries in ADO help pls

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=3191
Printed Date: 28 March 2026 at 11:59pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: parameterized queries in ADO help pls
Posted By: PrivateEye
Subject: parameterized queries in ADO help pls
Date Posted: 01 June 2003 at 3:46pm

I am using MS Access 2000, in VB 6 I have written the following code using ADO 2.0 to pass the value of date as parameter to the Access Query but it is giving me error "type mismatch" even if I don't use the "#" sign for the date. Anyone help me pls

Dim cmd As New ADODB.Command
Dim ParamItem As Parameter
Dim strSQL As String

strSQL = "SELECT tblSales.broker_id, tblSales.total_amount, tblSales.curent_date"
strSQL = strSQL & " FROM tblSales"
strSQL = strSQL & " WHERE (((tblSales.curent_date)=?));"

cmd.ActiveConnection = strCon
cmd.CommandText = "qryTest"
cmd.CommandType = adCmdTable

Set ParamItem = cmd.CreateParameter("dtmDate", adDate, adParamInput, "#5/2/03#")

cmd.Parameters.Append ParamItem
cmd.Execute

Set cmd = Nothing
Set ParamItem = Nothing



-------------
The Judgement Day



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net