Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi every body I need help to create username and password with SQL server and I will validity for the user to change the username and password how to do that with c# ??
Posted
Comments
Sandeep Mewara 3-Feb-13 12:18pm    
This is not a well framed question! We cannot work out what you are trying to do/ask from the post. Please elaborate and be specific.
Use the "Improve question" link to edit your question and provide better information.
abu- himade 3-Feb-13 14:27pm    
I am sorry I want to create form windows form application Contains two text box username and password those text box must be link with SQL server and Give the user the authority to change the user name and password
you get that?
milenalukic 3-Feb-13 12:56pm    
What have you tried so far?
abu- himade 3-Feb-13 14:28pm    
I am sorry I want to create form windows form application Contains two text box username and password those text box must be link with SQL server and Give the user the authority to change the user name and password
you get that?
Balamurugan1989 3-Feb-13 13:19pm    
Do you want to retrive username and password from sql to c#???

If and ONLY if you are referring to a SQL Server user and not a Windows authentication user then you can use the TSQL command "create user" to manage the user on SQL Server.

Then it is a matter of doing the following
1. Create the code that calls "create user" (and associated other user TSQL)
2. Wrap in an API
3. Use that API in a user display such as a C# GUI or web API.
 
Share this answer
 
You follow the below steps for this process,
1.Create two textboxes in design form.
2.In coding you need to follow the below process,
C#
//Add this namespace
using System.Data.Sqlclient;

oledbconnection con;
oledbdatareader dr;
oledbcommand cmd;

//We need to write the connection string
con=new sqlconnection ("Data Source=  ;Integrated Security=   ;User Id=  ; Pwd=  '");
//Now rightclick the button and write the below coding
{
con.Open();
cmd = new SqlCommand("SELECT UserName ,pwd FROM [aaa] WHERE UserName='" + textBox1.Text + "' AND pwd='" + textBox2.Text + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
string userText = textBox1.Text;
string passText = textBox2.Text;
if (dr.Read())
{

this.Hide();
ddd mp = new ddd();
mp.Show();
dr.Close();
con.Close();
}
}

If you are following the above steps you will get the output perfectly.
 
Share this answer
 
v3

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