读书人

SQL 语句动态写法

发布时间: 2012-03-29 12:53:12 作者: rapoo

SQL 语句动态写法 ?在线等
SQL 语句能这样写吗 我要查询的是动态的 可变的

C# code
SqlConnection con = new SqlConnection("server=localhost;database=7daydian;uid=sa;pwd=1234");        string dia = "dianliang";        string sql = "select '"+dia+"' from tongji order by shijian";        SqlCommand com = new SqlCommand(sql, con);


我执行了下 没有结果

应该怎样写啊
在线等 急!

[解决办法]
string dia = "dianliang";

string sql = "select ["+dia+"] from tongji order by shijian";

[解决办法]
where riqi>='' and
注意and前后空格

读书人网 >SQL Server

热点推荐