Command Parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • msali36
    New Member
    • Sep 2007
    • 13

    Command Parameters

    do you know what wornge with this

    dim number as integer = 3453



    myCommand = New OleDbCommand("S elect * from emp where eno=@number", myConnection)

    myCommand.Param eters.Add("@id" , OleDbType.Integ er).Value = number
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Easy.
    You use @number in the command string and then use @id in the parameter adding.

    Comment

    • msali36
      New Member
      • Sep 2007
      • 13

      #3
      Even by changing it does'nt work

      Comment

      • msali36
        New Member
        • Sep 2007
        • 13

        #4
        myCommand = New OleDbCommand("S elect * from emp where ename like '@Name' ", myConnection)

        Dim par As New OleDbParameter( "@Name", OleDbType.VarCh ar)

        par.Value = "FORD"

        myCommand.Param eters.Add(par)

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          What doesn't work about it?

          Comment

          Working...