string user_name;
user_name = "shanying";
com.CommandText = "insert into " + user_name + "_single_selected select top " + TextBox_count_multi.Text + " * from single_select where id not in (select id from " + user_name + "_single_selected) order by NEWID()";
问题肯定是出在user_name 身上,但我无法理解这个问题。因为如果把所有的user_name替换成"shanying",则执行结果正确。现在这样子出错无法执行。
------解决方案--------------------------------------------------------
无法理解??你按照下面红色部分输出一下,然后拿到查询分析器里执行看看。
string user_name;
user_name = "shanying";
string strSQL = "insert into " + user_name + "_single_selected select top " + TextBox_count_multi.Text + " * from single_select where id not in (select id from " + user_name + "_single_selected) order by NEWID()";
Response.Write(strSQL); //检查一下表名是不是你期望的那个??
com.CommandText = strSQL;
------解决方案--------------------------------------------------------
------解决方案--------------------------------------------------------