Click here to Skip to main content
16,014,121 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how will i make connection in login page
login page contain-
login_id.........
passward.........
Posted

1 solution

please try the following.
using System.Data.SqlClient;
using system.Data;

on click event of button please write
sqlconnection conn=new Sqlconnection("Your Connection String");
if(conn.state.equals(connectionstate.closed)
conn.open();
sqlcommand cmd=new sqlcommand("SELECT COUNT(ID) FROM table_name where Log_in='"+login_id+"' AND password='"+Password+"'",conn);
sqldataadapter da=new sqldataadapter(cmd);
if(cmd.executeNonQuery()>0)
response.write("<script>alert('valid user')</script>");
else
response.write("<script>alert('Invalid user')</script>");

i assumes that your field is primary key.replace the name of table with table_name of sqlcommand.
 
Share this answer
 
Comments
nikk0026 10-Jul-10 9:45am    
Reason for my vote of 5
exact code that i want

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900