prepared statement for MySql database

Discussion in 'C#' started by boba5555, Apr 6, 2008.

  1. #1
    Hello,
    Are there exist prepared statements for MySql databases that can be used through ASP. I have this code
    
            Dim conn
    	
    	Set conn = Server.CreateObject("ADODB.Connection")
    	conn.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=server_name; Port=3306; DATABASE=db_name; UID=un;PASSWORD=pwd; OPTION=4"
            Dim rs
            Dim dbCommand
    	Set dbCommand = Server.CreateObject("ADODB.Command")
    	Set dbCommand.ActiveConnection = conn
    	dbCommand.CommandType = adCmdText
    	dbCommand.CommandText = "SELECT username, password, autcode FROM users WHERE username=? AND password=?"
    	dbCommand.Parameters.Append (dbCommand.CreateParameter("username", adChar, adParamInput, Len(username), username))
    	dbCommand.Parameters.Append (dbCommand.CreateParameter("password", adChar, adParamInput, Len(password), password))
    	Set rs = dbCommand.Execute
    
    Code (markup):
    but at line
    
    dbCommand.CommandType = adCmdText
    
    Code (markup):

    I am getting error mesage:
    "ADODB.Command error '800a0bb9'

    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. "

    Can someone help me? Thank you in advance.
     
    boba5555, Apr 6, 2008 IP
  2. InfoSmith

    InfoSmith Peon

    Messages:
    884
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Did you set value to adCmdText?
     
    InfoSmith, Apr 6, 2008 IP