Click here to Skip to main content
Sign Up to vote bad
good
See more: C#ASP.NETMySQL
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 24 Dec '12 - 19:44


2 solutions

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

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 428
1 OriginalGriff 318
2 Mayur_Panchal 148
3 Mohammed Hameed 145
4 Dave Kreskowiak 120
0 Sergey Alexandrovich Kryukov 8,123
1 OriginalGriff 6,173
2 CPallini 3,482
3 Rohan Leuva 2,703
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid