General discussion

  • Creator
    Topic
  • #2180175

    Passing parameters from VB6 to SQL

    Locked

    by setivi ·

    Dim intVal as Integer
    intval = 2020
    qconn.Execute(“Select * from Table1 where userid=intval”)

    The question is how can I make sql recognize or accept intval as a predefined variable in VB6 and run the query with resultset based on the value of intval?

All Comments

  • Author
    Replies
    • #3117568

      Reply To: Passing parameters from VB6 to SQL

      by dennis.keeling ·

      In reply to Passing parameters from VB6 to SQL

      You need to ensure that the substitution takes place before the statement is executed.

      “SELECT * FROM Table1 WHERE [UserID} =” & intval

    • #3119255

      Reply To: Passing parameters from VB6 to SQL

      by dragon emperor ·

      In reply to Passing parameters from VB6 to SQL

      Dim intVal as Integer
      intval = 2020
      qconn.Execute(“Select * from Table1 where [userid]=” & CStr(intval))

      As an alternative you could use a command object with parameters, but the above is the simplest to get the result you want.

    • #3130622

      Reply To: Passing parameters from VB6 to SQL

      by setivi ·

      In reply to Passing parameters from VB6 to SQL

      This question was closed by the author

Viewing 2 reply threads