无法将类型“object”隐式转换为“System.Data.SqlClient.SqlDataReader
stringcoonstring=@"datasource=ZHANGQI-FBFAF99;initialcatalog=dbasp;integratedsecurity...
string coonstring = @"data source=ZHANGQI-FBFAF99;initial catalog=dbasp;integrated security=sspi";
SqlConnection coon = new SqlConnection(coonstring);
string cmdstring = "select shunxu from xs";
SqlCommand cmd = new SqlCommand(cmdstring, coon);
coon.Open();
SqlDataReader reder = cmd.ExecuteScalar();
xianshi.DataSource = reder;
xianshi.DataBind();
这段代码错在那里了.老这样提示,说SqlDataReader reder = cmd.ExecuteScalar();错了.可是就是看不明白. 展开
SqlConnection coon = new SqlConnection(coonstring);
string cmdstring = "select shunxu from xs";
SqlCommand cmd = new SqlCommand(cmdstring, coon);
coon.Open();
SqlDataReader reder = cmd.ExecuteScalar();
xianshi.DataSource = reder;
xianshi.DataBind();
这段代码错在那里了.老这样提示,说SqlDataReader reder = cmd.ExecuteScalar();错了.可是就是看不明白. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询