SqlConnection sql = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\UserAccounts.sql.mdf;Initial Catalog = UserAccounts; Integrated Security=True;Connect Timeout=30;User Instance=True");
SqlDataAdapter sda = new SqlDataAdapter();
sda.InsertCommand = new SqlCommand("INSERT INTO Details VALUES (@UserName, @Password)", sql);
sda.InsertCommand.Parameters.Add("@UserName", SqlDbType.VarChar).Value = UserName.Text;
sda.InsertCommand.Parameters.Add("@Password", SqlDbType.VarChar).Value = Password.Text;
sql.Open();
sda.InsertCommand.ExecuteNonQuery();
sql.Close();
I'm working with WindowsForms, where the concept of the program is to allow the user to register as a user by entering a 'userName' and 'password and storing it into the database 'userAccounts' in the table 'Details'.
This code is executed when the user clicks onto the 'okay' button.
However, I keep getting the cannot find table 'Details'
thank you in advance

New Topic/Question
Reply



MultiQuote





|