Hi all!
i want to validate the user name and password using an sql table i created.
i have tried the following code:
but my code seems to validate even the incorrect entries and also the fonts get enlarged on postback. can any body pls tell me what is the problem with this code? i'll be greatfull..
i want to validate the user name and password using an sql table i created.
i have tried the following code:
Code:
SqlConnection myConnection = new SqlConnection("data source=myPC;database=myDB;uid=abc;password=abc123"); DataSet dsFillData = new DataSet(); SqlCommand cmdobj = new SqlCommand("Select * from tbl_LoginIDsets", myConnection); cmdobj.CommandType = CommandType.Text; SqlDataAdapter daAdapter = new SqlDataAdapter(cmdobj); daAdapter.Fill(dsFillData); SqlDataReader dr = null; myConnection.Open(); dr = cmdobj.ExecuteReader(); if(dr.Read()) { Response.Write("Valid User"); } else { Response.Write("Invalid User"); } } }
Comment