[在线等]如何在Sql语句中使用字符串表名称 string TableName = xxxxxxx;string sql = "select * from " + TableName + " where ..............."; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你使用如下的方法看看,是否能够满足您的要求:declare @Table varchar(20)declare @Sql varchar(100)select @Table='sysobjects'select @Sql='select * from ' +@Tableexec(@Sql)此例子使用的是字符表名称。 string table="table1";string sql="select * from "+table; string m_table = "users";string sql = "select * from " + m_table + " where id>0 "; string TableName = "test";string sql = "select * from " + TableName + " where ..."; 大家好,小弟学.NET不久 希望能得到一本新手看的MVC框架的电子书 报错:尝试读取或写入受保护的内存,这通常是指示其他内存已损坏 倾家荡产问个问题:C#能做反外挂程序吗?需要学习什么 Form先最小化,然后恢复就出错。。。 FTP上传,中文乱码问题 远程物件 如何去除用Graphics在picturebox上画的线? Word标签问题,在线等 datagridview问题~~ 诸位兄弟帮帮忙呀 !! 关于DataGrid和DataSet结合的假象 绘图难题
declare @Table varchar(20)
declare @Sql varchar(100)
select @Table='sysobjects'
select @Sql='select * from ' +@Table
exec(@Sql)
此例子使用的是字符表名称。
string sql="select * from "+table;
string sql = "select * from " + m_table + " where id>0 ";
string sql = "select * from " + TableName + " where ...";