SqlConnection LoginConnection = new SqlConnection(@"Data source = (local);Initial Catalog = booksalesystem;Integrated Security = True;Connect Timeout = 30");
SqlDataAdapter LoginAdapter = new SqlDataAdapter("SELECT AdministratorAccount, AdministratorPassword FROM Administrator WHERE AdministratorAccount = AccountBox.Text", LoginConnection);
DataTable LoginDataTable =new DataTable();
LoginAdapter.Fill(LoginDataTable);
if (LoginDataTable.Rows.Count > 0)
{
if ((string)LoginDataTable.Rows[0][1] == PasswordBox.Text)
{
AdministratorForm LoginAdForm = new AdministratorForm();
this.Close();
LoginAdForm.Show();
}
else
{
MessageBox.Show("密码输入错误!", "圣灵图书销售");
return;
}
}
else
{
MessageBox.Show("账号输入错误!", "圣灵图书销售");
return;
}
}
为什么说 无法绑定由多个部分组成的标识符 "AccountBox.Text"
SqlDataAdapter LoginAdapter = new SqlDataAdapter("SELECT AdministratorAccount, AdministratorPassword FROM Administrator WHERE AdministratorAccount = AccountBox.Text", LoginConnection);
DataTable LoginDataTable =new DataTable();
LoginAdapter.Fill(LoginDataTable);
if (LoginDataTable.Rows.Count > 0)
{
if ((string)LoginDataTable.Rows[0][1] == PasswordBox.Text)
{
AdministratorForm LoginAdForm = new AdministratorForm();
this.Close();
LoginAdForm.Show();
}
else
{
MessageBox.Show("密码输入错误!", "圣灵图书销售");
return;
}
}
else
{
MessageBox.Show("账号输入错误!", "圣灵图书销售");
return;
}
}
为什么说 无法绑定由多个部分组成的标识符 "AccountBox.Text"
解决方案 »
- 发了几个帖子,无人问津,有会Devexpress控件的吗?
- crawler.StatusChanged(crawler, null)代码到底做什么用?
- 各位老鸟、大侠,请来帮忙分析一下专业,概括一下方向、路线图。
- 用数组记录数据库的值
- 高手来看,新问题
- 100分求教如何用GDI+在Form上实现液柱上升下降的动画效果。
- 文件读取怎样避免出现乱码?
- TFS的服务器跟VS2010是同一个东西吗?
- 请问怎么提取字符串
- ________________电脑怎么玩比较爽???.......................................
- 关于构造函数
- 样把一个以逗号分隔的字符串变成一个数组?
如果是字符型的话 AdministratorAccount = "'" + AccountBox.Text.ToString() + "'"