/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
protected void btnSubmit_Click(object sender, EventArgs e) { string connectionString = ConfigurationManager.ConnectionStrings["dragSlips_dbConnectionString"].ConnectionString; { login.Connection = myConnection; myConnection.Open(); login.Parameters.AddWithValue("@username", txtUsername.Text); login.Parameters.AddWithValue("@password", txtPassword.Text); login.CommandText = "[login]"; login.CommandType = System.Data.CommandType.StoredProcedure; object myResult = login.ExecuteScalar(); if (Convert.ToInt32(myResult) == 0) { lblLoggedIn.Text = "try again!"; } else { Response.Redirect("admin.aspx"); } //MyConnection myConnection.Close(); } }