using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
SqlConnection mycon = new SqlConnection("server=.;database=ccsit;uid=sa;pwd=sa");
SqlCommand cmd = new SqlCommand();
protected void Page_Load(object sender, EventArgs e)
{
mycon.Open();
cmd.Connection = mycon;
}
protected void Button1_Click1(object sender, EventArgs e)
{
cmd.CommandText = "select count (*) from login where uname='" + TextBox1.Text + "'";
int i = (int)cmd.ExecuteScalar();
if (i == 1)
{
Response.Write("");
TextBox1.Text = "";
}
else
{
cmd.CommandText = "insert into login values ('" + TextBox1.Text + "','" + TextBox3.Text + "','"+TextBox4 .Text+"','"+RadioButtonList1 .Text+"','"+DropDownList1 .Text+"')";
cmd.ExecuteNonQuery();
Response.Redirect("signin.aspx");
}
}
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
}
}
No comments:
Post a Comment