www.webdeveloper.com
Results 1 to 2 of 2

Thread: C# SQL server

  1. #1
    Join Date
    Nov 2010
    Posts
    6

    C# SQL server

    hi, i m trying to make something like a login page with C# using VS 2010 and SQL server database. I am using the following code to get the password from the appropriate username but i get an error of Object reference not set to an instance of an object.
    . here is the code:

    Code:
           String username = txtusername.Text;
            String password = txtpass.Text;
    
            String connStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            SqlConnection conn = new SqlConnection(connStr);
            SqlCommand cmd = new SqlCommand();
            conn.Open();
            cmd.Connection = conn;
            cmd.CommandText = "Select password from Details WHERE username=' " + username + "'";
           
            String pass=cmd.ExecuteScalar().ToString();
            Console.WriteLine(pass);
            conn.Close();
    Any help please?

  2. #2
    Join Date
    Jan 2011
    Posts
    6
    Hi Pikkas,
    I am currently looking for a Software Developer in Illinois for a full time permanent position at our company. Do you know of anyone that is looking to change companies?
    I appreciate any leads, thank you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles