string table = "City";
string query = "Select * from '"+table+"'";
This gives me error stating incorrect symbol near ".
However,
string query = "Select * from City";
Gives the proper output.
You just this
string query = "Select * from '"+table+"'";
to be replaced by
string query = "Select * from " + table;
Because you Query string is not "Select * from City";
While it is forming "Select * from 'City'";
and thus you getting error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With