Could anyone point me into the right direction on how to make a C# SQL Datalogin?
GAME -5 Junior Poster
Recommended Answers
Jump to Postusing System.Data.SqlClient; SqlConnection conn=new Sqlconnection("YourConnectionString"); conn.Open(); string qry="SELECT * FROM Tablename"; Sqlcommand cmd=new SqlCommand(qry,conn); bool userFound=false; SqlDatareader dr; dr=cmd.ExecuteReader(); while(dr.Read()) { if(user==user.Text&&pass=pass.Text) { userFound=true; break; } } if(userFound) { //Do Something e.g Response.Redirect("ToSomePage.aspx"); } else { }
Jump to PostThis is my code (I actually use it as well):
public static bool LogingInMethod(string userName, string password) { bool result = false; string sqlQuery = "SELECT UserName, Password FROM Users WHERE UserName ='" + userName + "'"; using (SqlConnection sqlConn = new SqlConnection(p)) { SqlCommand cmd = …
Jump to PostThat has to be a remote db. So everyone can access it. Some info.
Jump to PostWhat do you mean? A method in Win form to insert userName, password and an email to sql dataBase?
YOu have to pass the data from textBoxes to sql command parameters, end execute the procedure.
Try this code:private void InsertingData() { string connString = @"server=x;uid=y;pwd=z;database=xyz"; //this …
All 17 Replies
mcriscolo 47 Posting Whiz in Training
edgias 0 Newbie Poster
Singlem 0 Light Poster
jugosoft 25 Junior Poster in Training
Singlem 0 Light Poster
Mitja Bonca 557 Nearly a Posting Maven
GAME -5 Junior Poster
Mitja Bonca 557 Nearly a Posting Maven
GAME -5 Junior Poster
Singlem 0 Light Poster
GAME -5 Junior Poster
Singlem 0 Light Poster
shajis001 -1 Newbie Poster
shajis001 -1 Newbie Poster
GAME -5 Junior Poster
Mitja Bonca 557 Nearly a Posting Maven
GAME commented: Sweet, It worked... +0
GAME -5 Junior Poster
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.