hi
i am using two textboxes for username and password.
how to match whether this exist in datbase or not through c# code only.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
tom christPosted Jan 16, 2006, 2:09 AM
CREATE PROCEDURE Sp_Scheduler_Login
@userName nvarchar(50),@password nvarchar(50)
as
If Exists(select * from tbl_Scheduler_Project where userName=@userName AND password=@password)
Return 1
ELSE
Return 0
GO
and call this stored proc where u want to use.
or
DataSet ds= new DataSet()
fill this ds with the query (select * from tbl_AdminLogin where username = '" + TextBox1.text + "' and pass = '" + TextBox2.Text + "'")
if(ds.Table[0].Count>0)
{
allready exist
}
else
{
new user
}
Rajkumar MurugesanPosted Jan 15, 2006, 10:48 AM
CREATE TABLE User(
username varchar(50),
password varchar(50)
)
dim int temp;
SqlConnection con=new SqlConnection(connection String here);
con.open();
SqlCommand cmd=new SqlCommand(SELECT count(*)FROM user WHERE username='
while(dr.Read());
{
temp=Convert.ToInt64(dr[0]);
}
if(temp==0)
{
Response.Redirect("Login.aspx");
}
else
Response.Redirect("Welcome.aspx");
i hope that this will work out...