good day guys! anyone can help me about this.. i need to create a login form with database (users.mdf) im newbie in c# .net i manage to create a connection my problem is the code behind the Login_Button

thanks God bless

Recommended Answers

All 2 Replies

Make two text boxes(for name and password) and one button on the login form. set password character of the password text box passwordBox.PasswordCharachter="*"; then connect you form with database using following code

connection = new SqlConnection("Data Source=Server_name;Initial Catalog=DB_name;Integrated Security=true");
connection.Open();
SqlCommand Command = connection.CreateCommand();
Command.Parameters.Clear();                
Command.Connection = connection;
Command.CommandText = "Select user_id, Password from Table_name";
Command.CommandType = CommandType.Text;
SqlDataAdapter Adapter = new SqlDataAdapter(Command);
Adapter.Fill(dataSet1, Table_name);
//button click event
//Code to check your user_id and password from the dataset1

thank u abelLazm for your solution.. appreciate it!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.