public static void checkInfo(Qinfo qinfo) { string query = string.Format(@"Insert into DSMyDB Values ('{0}', '{1}')", qinfo.uName, qinfo.pWord); cmd = new SqlCommand(query, cn); try { cn.Open(); cmd.ExecuteNonQuery(); } finally { cn.Close(); } }
protected void check_Click(object sender, EventArgs e) { try { string username = uName.Text; string password = pWord.Text; Qinfo infoCheck = new Qinfo(username, password); Qconnect.checkInfo(infoCheck); result.Text = "Register Successfully!" + "Go to LogIn Page: http://localhost:10926/week12_Rquiz4.aspx"; } catch { result.Text = "Register Failed!"; } }