Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i create a login and user in Sql server 2008.with this command
SQL
CREATE LOGIN test0101
    WITH PASSWORD = 'areyou123!';
GO

and User
SQL
CREATE USER test0101 FOR LOGIN test0101;
GO

but i can not connect to database engine. I get this error
login failed for User 'test0101' error 18456.
i need create a login in Sql Server for c# project(winform).
please help me.
thank you.
Posted

Quote:
I get this error
login failed for User 'test0101' error 18456.
Did you search Google for this error? I got the below one.
Microsoft sql server error 18456 login failed for user[^]
 
Share this answer
 
Comments
CPallini 10-Dec-13 3:20am    
5.
C#
DataSet ds = new DataSet();
                        SqlDataAdapter da = new SqlDataAdapter("select * from Admin_Login where username ='" + txtusername.Text + "' and password='" + txtpassword.Text + "'", sconn);
                        da.Fill(ds);
                        int count = ds.Tables[0].Rows.Count;
                        if (count == 0)
                        {
                            MessageBox.Show("Wrong username or password");
                            
                            txtusername.Focus();

                        }
                        else
                        {
                            successpage pg= new successpage ();
                            pg.Show();
                            this.Hide();
                        }
                        sconn.Close();
 
Share this answer
 

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