using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; public partial class _Default : System.Web.UI.Page { SqlConnection con = new SqlConnection(@"Data Source=NEENA-PC\SQLEXPRESS;Initial Catalog=practice;Integrated Security=True"); public void custom() { string select = "Select name from [insert]"; SqlCommand cmd=new SqlCommand(select,con); SqlDataReader sdr; con.Open(); sdr = cmd.ExecuteReader(); //if (!IsPostBack) //{ if (sdr.Read()) { if (TextBox1.Text == sdr[0].ToString()) { Label1.Text = "error"; TextBox1.Text = ""; TextBox1.Focus(); //CustomValidator1.ErrorMessage = "erroe"; } else { Label1.Text = "ok"; //CustomValidator1.ErrorMessage = "scd"; } } // } con.Close(); } protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { custom(); Response.Write("Hiii"); } }
name
Select * from [insert] where name=@name
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)