Click here to Skip to main content
15,899,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
Iam Using asp.net with c# with backend as MYSql,

i want to select the table name from dropdownlist but it is giving me error can you correct it where iam missing something. below is code iam using.

string select=DropDownList1.SelectedItem.Value;

string sql="select * from '" + select+"';

MySqlCommand cmd = new MySqlCommand(sql, mycon);
Posted

problem is with your query dont use single quotes (')
do like this
C#
string sql="select * from " + select+";
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900