Hallo every one im trying to insert a new User_Name into a table using mysql but I keep getting error That company Name already exsits below is my insert statement
MySqlCommand sqlcom = new MySqlCommand("Insert Into t_users(Company_Name, User_Name,Serial_Number,Full_Name,Password,Cell_Number,Email,User_Type,Active,
Keywords,Signature)VALUE(@Company_Name,@User_Name,@Serial_Number,@Full_Name,@Password,@Cell_Number,@Email,@User_Type,@Active,@Keyword,@Signature)
sqlcom.Parameters.Add("@Company_Name", MySqlDbType.VarChar, 100).Value =CompanyName;
sqlcom.Parameters.Add("@User_Name", MySqlDbType.VarChar, 100).Value = txtInsertUser.Text;
sqlcom.Parameters.Add("@Serial_Number", MySqlDbType.VarChar, 100).Value = txtInsertSerial.Text;
sqlcom.Parameters.Add("@Full_Name", MySqlDbType.VarChar, 100).Value = txtInsertFullName.Text;
sqlcom.Parameters.Add("@Password", MySqlDbType.VarChar, 100).Value = txtInsertPassword.Text;
sqlcom.Parameters.Add("@Cell_Number", MySqlDbType.VarChar, 100).Value = txtInsertCell.Text;
sqlcom.Parameters.Add("@Email", MySqlDbType.VarChar, 100).Value = txtInsertEmail.Text;
sqlcom.Parameters.Add("@User_Type", MySqlDbType.Bit).Value = chkUsertypeInsert.Checked;
sqlcom.Parameters.Add("@Active", MySqlDbType.Bit).Value = chkInsertActive.Checked;
sqlcom.Parameters.Add("@Keyword", MySqlDbType.VarChar, 100).Value = txtInsertKeyword.Text;
sqlcom.Parameters.Add("@Signature", MySqlDbType.VarChar, 100).Value = txtInsertSignature.Text;
sqlcom.ExecuteNonQuery();
MySqlDataAdapter da = new MySqlDataAdapter("select * from T_company", mycon2);
DataSet ds = new DataSet();
da.Fill(ds);
DataTable dt = new DataTable();
da.Fill(dt);
gdvauthors.DataSource = dt;
gdvauthors.DataBind();
my table
has the following columns
Company name PK
User_name pk
Serial_number
Full_Name
Password
Cell_Number
Email
User_type
Active
Keywords
Signature