c#中SqlDataReader dr = cmd.ExecuteReader();然后读取dr.read(),用了while循环,就一直循环了
我查到的数据只有3条然后就一直循环出现这3条数据,代码如下stringsql=sql语句;SqlConnectioncon=newSqlConnection("serve...
我查到的数据只有3条然后就一直循环出现这3条数据,代码如下
string sql =sql语句; SqlConnection con = new SqlConnection("server=XL-20120505YISU;database=jianguan;uid=sa;pwd=123");
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
this.label2.Text += " " + dr[0].ToString() + " " + dr[1].ToString() + "\n";
} 展开
string sql =sql语句; SqlConnection con = new SqlConnection("server=XL-20120505YISU;database=jianguan;uid=sa;pwd=123");
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
this.label2.Text += " " + dr[0].ToString() + " " + dr[1].ToString() + "\n";
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询