如何解决如何使用凭据,例如:login.cs中的员工社会保险号以另一种形式反映出来,例如:expense.cs无需手动键入
private void simpleButton1_Click(object sender,EventArgs e)
{
try
{
string myConnection = "datasource = localhost;database = imprest system;port = 3306;username = root;password = ''";
MysqLConnection myConn = new MysqLConnection(myConnection);
MysqLCommand SelectCommand = new MysqLCommand("select * from user where **employeeSSN = '" + employeeSSN_txt.Text + "'** and Password = '" + pass_txt.Text + "'",myConn);
MysqLDataReader myreader;
myConn.open();
myreader = SelectCommand.ExecuteReader();
int count = 0;
while (myreader.Read())
{
count = count + 1;
}
if (count == 1)
{
Dashboard dashboard = new Dashboard();
dashboard.ShowDialog();
}
else if (count > 1)
{
XtraMessageBox.Show("Error logging in");
}
else
{
XtraMessageBox.Show("Incorrect Username and Password.Try Again");
}
}
catch (Exception ex)
{
XtraMessageBox.Show(ex.Message);
}
}
我想使用Employee社保号而无需手动输入的代码部分。
private void simpleButton1_Click(object sender,EventArgs e)
{
string myConnection = "datasource = localhost;database = imprest system;port = 3306;username = root;password = ''";
MysqLConnection myConn = new MysqLConnection(myConnection);
MysqLCommand InsertCommand = new MysqLCommand("insert into expenseaccount where ExpenseType = '" + Expense_txt + "' and Amount = '" + Amount_txt + "' and **employeeSSN =** ",myConn);
MysqLDataReader myreader;
myConn.open();
myreader = InsertCommand.ExecuteReader();
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。