C# 关於listbox显示问题 (SQL) 20
privatevoidbutton8_Click(objectsender,EventArgse)//点击帐户查询{using(this.sqlConnection1){...
private void button8_Click(object sender, EventArgs e)//点击 帐户查询
{
using (this.sqlConnection1)
{
SqlCommand sqlcon6 = new SqlCommand();
sqlcon6.Connection = this.sqlConnection1;
sqlcon6.CommandText = "select Caccount from enter_Customer";
SqlDataReader dr1 = sqlcon6.ExecuteReader();
while (dr1.Read())
{
this.CustomerMessagelistBox.Items.Add("帐户余额:" + dr1.ToString());
}
}
}
语法没有错误,但是出现异常,系统提示:“设置DataSource属性后无法修改项集合”,本人菜鸟 请问该怎样该?详细过程...
不是你那答案哦~ 我加了 [0]之后还是提示相同的异常 展开
{
using (this.sqlConnection1)
{
SqlCommand sqlcon6 = new SqlCommand();
sqlcon6.Connection = this.sqlConnection1;
sqlcon6.CommandText = "select Caccount from enter_Customer";
SqlDataReader dr1 = sqlcon6.ExecuteReader();
while (dr1.Read())
{
this.CustomerMessagelistBox.Items.Add("帐户余额:" + dr1.ToString());
}
}
}
语法没有错误,但是出现异常,系统提示:“设置DataSource属性后无法修改项集合”,本人菜鸟 请问该怎样该?详细过程...
不是你那答案哦~ 我加了 [0]之后还是提示相同的异常 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询