protected void selected_items(object source, DataListCommandEventArgs e) { if (con.State == ConnectionState.Closed) { con.Open(); } if (e.CommandName == "Submit") { TextBox pri_key = (TextBox)e.Item.FindControl("txtprivate_key"); if (pri_key.Text != " ") { txtprivate_key = Int32.Parse(pri_key.Text); } SqlCommand cmd = new SqlCommand("select public_key from audit where private_key='" + txtprivate_key + "' and t_name='fir'", con); pif(); if (Convert.ToInt32(cmd.ExecuteScalar()) == 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "<script>alert('Private Key not Valid')</script>"); } else { Response.Redirect("fir2.aspx"); } } } public void pif() { if(con.State==ConnectionState.Closed) { con.Open(); } SqlCommand cmd1 = new SqlCommand("select public_key,t_name from audit where private_key='"+txtprivate_key+"' and t_name='pif'", con); if (Convert.ToInt32(cmd1.ExecuteScalar()) == 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "<script>alert('Private Key not Valid')</script>"); } else { Response.Redirect("pif2.aspx"); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)