必须声明标量变量 "@用户名"。 100
sqlconnectconn=newsqlconnect();SqlDataAdaptermydata;BindingSourcebs=newBindingSource(...
sqlconnect conn = new sqlconnect();
SqlDataAdapter mydata;
BindingSource bs = new BindingSource();
DataTable table = new DataTable();
SqlCommand com;
private void 消费查询_Load(object sender, EventArgs e)
{
com = conn.GetCon().CreateCommand();
tb_yonghuxinxi yhxx = new tb_yonghuxinxi();
//yhxx.Yonghuxingming = 用户登录.YH;
mydata = new SqlDataAdapter("select * from dd where yonghuming = @用户名", conn.GetCon());
yhxx.Yonghuxingming = 用户登录.YH;
com.Parameters.Add(new SqlParameter("用户名", yhxx.Yonghuxingming));
mydata.Fill(table);
bs.DataSource = table;
dataGridView1.DataSource = bs;
mydata.Fill(table);
走到这里就会出现
必须声明标量变量 "@用户名"。
怎么改? 展开
SqlDataAdapter mydata;
BindingSource bs = new BindingSource();
DataTable table = new DataTable();
SqlCommand com;
private void 消费查询_Load(object sender, EventArgs e)
{
com = conn.GetCon().CreateCommand();
tb_yonghuxinxi yhxx = new tb_yonghuxinxi();
//yhxx.Yonghuxingming = 用户登录.YH;
mydata = new SqlDataAdapter("select * from dd where yonghuming = @用户名", conn.GetCon());
yhxx.Yonghuxingming = 用户登录.YH;
com.Parameters.Add(new SqlParameter("用户名", yhxx.Yonghuxingming));
mydata.Fill(table);
bs.DataSource = table;
dataGridView1.DataSource = bs;
mydata.Fill(table);
走到这里就会出现
必须声明标量变量 "@用户名"。
怎么改? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询