大家看看下面这段程序的问题出在哪里???
说明当n<2000时程序都不会抛出异常。
程序主要是为了测试in(1,2,3,...n)中n的最大值为多少
相关贴子:
http://expert.csdn.net/Expert/topic/2840/2840481.xml?temp=.9044306
-----------------------------------------
string s="";
int n=3000;
for(int i=0;i<n;i++){s+=(i+",");}
s+="0";
string strConnection="连接字符串";
SqlConnection conn=new SqlConnection(strConnection);
string sql="select * from students where studentid in("+s+")";
DataSet ds=new DataSet();
try
{
SqlDataAdapter adapter=new SqlDataAdapter(sql,conn);
adapter.Fill(ds);
MessageBox.Show("ok!!");
}
catch(SqlException se)
{
MessageBox.Show(se.Message);
}