public void Auto_Login() { string usernameConfig = WebConfigurationManager.AppSettings["username"]; string islogined = WebConfigurationManager.AppSettings["islogined"]; string passwd = WebConfigurationManager.AppSettings["passwd"]; if (islogined == "1") { My_SqlCon sqlCon = new My_SqlCon(); var sqlConnection = sqlCon.GetConnection(); SqlDataReader dr = sqlCon.getSqlDr_Login("select * from usermanage where gh='" + usernameConfig + "'and passwd='" + passwd + "'", sqlConnection); if (dr.Read()) { String username = (string)dr[0]; Main_Menu.userInfo = new UserInfo(); Main_Menu.userInfo.Username = username; Main_Menu.userInfo.Type = (string)dr[2]; dr.Close(); sqlConnection.Close(); var thread1 = new Thread(this.openForm); thread1.Start(); } } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { task = new Task(); var mySqlCon = new My_SqlCon(); var sqlConnection = mySqlCon.GetConnection(); String serial = dataGridView1.CurrentRow.Cells[0].Value.ToString(); var dr = mySqlCon.getSqlDr_Login($"select * from task where serial='{serial}'", sqlConnection); if (dr.Read()) { task.Id = dr[0].ToString(); task.Serial = dr[1].ToString(); task.Shenheren = dr[2].ToString(); task.Time = dr[3].ToString(); task.Zherenren = dr[4].ToString(); task.Content = dr[5].ToString(); task.Gonghao = dr[6].ToString(); task.Sqtime = dr[7].ToString(); task.Status = dr[8].ToString(); task.Bu = dr[9].ToString(); task.Faqiren = dr[10].ToString(); task.Timeformat = dr[11].ToString(); task.Subject = dr[12].ToString(); } var formInfo_Sub = new FormInfo_Sub(task, this); dr.Close(); sqlConnection.Close(); formInfo_Sub.ShowDialog(); }
public bool Sql() { My_SqlCon sqlCon = new My_SqlCon(); var sqlConnection = sqlCon.GetConnection(); SqlDataReader dr = sqlCon.getSqlDr_Login("select * from usermanage where gh='" + textBox_UserName.Text + "'and passwd='" + textBox_Passwd.Text + "'", sqlConnection); if (dr.Read()) { String username = (string)dr[0]; Main_Menu.userInfo = new UserInfo(); Main_Menu.userInfo.Username = username; Main_Menu.userInfo.Type = (string)dr[2]; return(true); } dr.Close(); sqlConnection.Close(); return(false); }