Bug #43755 SQL where command not passing parameter @p
Submitted: 19 Mar 2009 16:57 Modified: 19 Mar 2009 22:19
Reporter: Thomas Lee Email Updates:
Status: Unsupported Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:5.0 OS:Windows
Assigned to: CPU Architecture:Any
Tags: @p parameter not passing SQL command

[19 Mar 2009 16:57] Thomas Lee
Description:
For VS 2003 or VS 2005 Express, click one record of ListView
,nID the # of record wont pass SQL Where command. If use oledb for 
Access database ok.

Private Sub LoadAddressInfoForEmp(ByVal nID As Integer)
        Dim SQL As String = "Select * from Employees where EmployeeID = @p"
        Dim Connectionstring As String

        'Dim oConn As New MySqlConnection()
        Dim oConn As New OdbcConnection()

        oConn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
                   & "server=127.0.0.1;" _
                   & "uid=Thomas;" _
                   & "pwd=system2;" _
                   & "database=northwind;" 
 
        Dim oCmd As New OdbcCommand(SQL, oConn)
        Dim oParm As New OdbcParameter("@p", SqlDbType.Int)
        Dim oRD As OdbcDataReader

        oParm.Direction = Data.ParameterDirection.Input
        oParm.Value = nID
        Call oCmd.Parameters.Add(oParm)
        Try
            Call oConn.Open()
            oRD = oCmd.ExecuteReader(CommandBehavior.CloseConnection)
            If (oRD.Read()) Then

How to repeat:
Create ListView fill with data, click any one record, should pass nID
to @p
[19 Mar 2009 22:10] MySQL Verification Team
Changing Category from Server DML to Connector/ODBC.
[19 Mar 2009 22:19] Jim Winstead
Connector/ODBC doesn't support named parameters. You can only use unnamed parameters using the '?' marker.