如何在Asp.net中连接MySql Querry中的dropdownlist值 [英] how to concatenate the dropdownlist value in MySql Querry in Asp.net
本文介绍了如何在Asp.net中连接MySql Querry中的dropdownlist值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Iam使用带有后端的c#作为MYSql的asp.net,
i想从下拉列表中选择表名但是它给了我错误你可以纠正它我丢失的东西。下面是我使用的代码。
string select = DropDownList1.SelectedItem.Value;
string sql = select * from''+ select +'';
MySqlCommand cmd = new MySqlCommand(sql,mycon);
解决方案
看看: http:// www .highdots.com / forums / macromedia-dreamweaver / searching-mysql-table-names-272001.html [ ^ ]
问题与您的查询不使用单引号(' ')
这样做
string sql = select * from + select + 跨度>
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);
解决方案
Take a look : http://www.highdots.com/forums/macromedia-dreamweaver/searching-mysql-table-names-272001.html[^]
problem is with your query dont use single quotes ('')
do like this
string sql="select * from " + select+";
这篇关于如何在Asp.net中连接MySql Querry中的dropdownlist值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文