How to make connectivity with sqlserver

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kuldeep singh sethi
    New Member
    • Oct 2006
    • 33

    How to make connectivity with sqlserver

    Hi All,


    I am facing a problem from many days. and need to help me. i am a local machine user. I am developing a site in which login page is as start page. and there is sql server as database. so i am writing this code:-

    using system data.sqlclient;


    sqlconnection objcon= new ("Connection string");
    sqlcommand objcom= new ("select * from tab_login where username= '"+txtusername. text+"' and password = '"+txtpassword. text+"'",objcon )
    objcon.open();
    sqldatareader dr = executedataread er();
    if(dr.read())
    {
    Response.redire ct("next page.aspx");
    }
    else
    {
    lblmessage.text = "Invalid Username or Password ";
    }

    so now when i am running this application then it is successfully build but when i put username and password then it shows the error message which is " Login failure",

    So i want to know that where i am doing wrong. If i am writing <identity impersonate="tr ue" /> in web.config file. then also it is giving error in web.config file.


    So any body can suggest me how to handle this error.


    Kuldeep singh sethi
Working...