Login Form using sql database c# -
I am trying to create a sign up page. You enter the username and password and save it in the SQL database.
Note: As long as I add another column (password), the matter works.
This is a password code (username is the same):
static public zero deletion (string _Password) {try {connection.Open ()} SqlCeCommand commandInstert = New SqlCeCommand ("Include [table] values (@ password)", connection); Command insert Parameter. Add ("password", password); CommandInsert.ExecuteNonQuery (); } Hold (SqlCeException Expaction) {message box. Show (Excl. ToString ()); } Finally {connection.Close (); }} and this button settings are:
Private Zero Button 1_Click (Object Sender, EventArgs e) {if (deleteBox.Text! = " } {SQLFunctions.Insert (insertBox.Text); SQLFunctions.delete (deleteBox.Text); SQLFunctions.Refresh (this.dataGridView1); } Other {message box. Show ("login failed"); }} Thanks
I think you need to make some changes to your code like this
SqlCeCommand commandInsert = new SqlCeCommand ("INSERT IN [TABLE] VALUES (@username, @password)", connection ); You should pass two parameters because you have two fields now DB and if you do not want to give a username, then you should specify this way < Pre> SqlCeCommand commandInsert = new SqlCeCommand ("INSERT [TABLE] (password) value (@ password)", connection); and
command insert. Parameter. Add ("password", password); It should be written as:
Command insert.Pameters.ad ("@ password", password); And to pass the values of this parameter, you can do this
command. Parameter. Advait Value ("@ password", insertBox.Text);
Comments
Post a Comment