none
C# application Sql Database Connection RRS feed

  • Question

  • Am new to C# programing , so am trying to create a login for my application using sql in my login window a login button has the code " private void logbtn_Click(object sender, EventArgs e)
            {
                SqlConnection con = new SqlConnection(@"Data Source=BV-PC\SQLEXPRESS;Initial Catalog=SIMSDb;Integrated Security=True");

                SqlDataAdapter Login_Info = new SqlDataAdapter("Select Count(*) From Login_Info where UserName ='" + usertxt.Text + "' and Password ='" + passtxt.Text + "'", con);
                DataTable dt = new DataTable();
                Login_Info.Fill(dt);
                if (dt.Rows[0][0].ToString()=="1")
                {
                    this.Hide();
                    Main ss =new Main ();
                    ss.Show ();
            }
                else
                {
                    MessageBox.Show(" Please double check your username and password");

                }
            }

    when i run the app i get the notification SqlException was unhandled with "Invalid object name 'Login_Info'."

    what am i doing wrong please help.

    Monday, November 23, 2015 10:56 AM

Answers

  • Esoft --

    You have erroneously posted your C# question in a user forum dedicated to Project Online, an enterprise project management application.  I would recommend you repost your question in a user forum dedicated to C# programming questions.  Hope this helps.


    Dale A. Howard [MVP]

    Monday, November 23, 2015 2:27 PM
    Moderator