Home > Mobile >  Can anyone please correct that MySql code,
Can anyone please correct that MySql code,

Time:07-28

In here "FromSt" and "EndSt" are variables.

I wanna run that code in Vb.net.

MySql console command:

select st_distance from addst WHERE st_name IN ("value1","value1");

VB.net code:

 Using FindSqlS As MySqlCommand = New MySqlCommand("SELECT st_distance FROM addst WHERE st_name = '" & FromSt & "OR" & "'st_name ='" & EndSt & "'", conn)

CodePudding user response:

Looks like you left out a quote and added an extra one in another place. Try this and see if it fixes your issue:

Using FindSqlS As MySqlCommand = New MySqlCommand("SELECT st_distance FROM addst WHERE st_name = '" & FromSt & "'" & " OR " & "st_name ='" & EndSt & "'", conn)
  • Related