问题描述
这是具有用户在登录时输入的凭据的登录页面。
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 (将#修改为@)