Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - parameterized queries in ADO help pls
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

parameterized queries in ADO help pls

 Post Reply Post Reply
Author
PrivateEye View Drop Down
Groupie
Groupie
Avatar

Joined: 21 March 2003
Location: United Kingdom
Status: Offline
Points: 168
Post Options Post Options   Thanks (0) Thanks(0)   Quote PrivateEye Quote  Post ReplyReply Direct Link To This Post Topic: parameterized queries in ADO help pls
    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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.