Can anyone please correct that MySql code,

Advertisements

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)

>Solution :

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)

Leave a ReplyCancel reply