Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

how can i change this command so that i can use LIKE, instead of " = " in the query (the part in red) ?

 

Private Sub doCommand()
    
        command = New OleDb.OleDbCommand("Select Patient_ID, SS_Patient_ID, First_Name, Middle_Name, Last_Name, Date_of_Birth from Demographics [color=Red]where First_Name = ? and Last_Name = ?[/color]", Me.OleDbConnection2)
       command.Parameters.Add(New OleDb.OleDbParameter("Fname", OleDb.OleDbType.VarChar, 20))
       command.Parameters.Add(New OleDb.OleDbParameter("Lname", OleDb.OleDbType.VarChar, 20))

       command.Prepare()

       command.Parameters.Item("Fname").Value() = Me.TextBox1.Text
       command.Parameters.Item("Lname").Value() = Me.TextBox2.Text
   End Sub

Posted

this didn't work either :( after some playing with the syntax i finally got it to work like this:

 

where First_Name LIKE '%'&?&'%' and Last_Name LIKE '%'&?&'%'

 

i am using Access db and vb.net

Posted

i would use

 

where First_Name Like " & % & " and Last_Name LIKE " & % & "

 

Access uses % as the wildcard figure

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

-- Rick Cook, The Wizardry Compiled

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...