Hi friends
I hope you are well
I have a problem is that I had a table named authorization in this structure
create table autorisation
(
Id_autorisation int primary key identity NOT NULL,
Id_user int foreign key references utilisateur (Id_user),
Id_site int foreign key references site (Id_site),
Id_profil int foreign key references profil (Id_profil)
)
In visual studio I have this interface

Code
And in the display I two not display Id_autorization and when I want to click on the modifierCode
it does not work with this request Program.cmd.CommandText = "authorizationCode
updateCode
in Id_site = (select top 1 Id_site site from the site where Libelle_site = '" + comboBox2.Text + "'),Code
Id_user = (select top 1 utilisateur User_name = '"+ comboBox1. Text +"'),Code
Id_profil = (select top 1 Id_profil from profil where Libelle_profile = '"+ comboBox3.Text +"')Code
where Id_user = (select top 1 utilisateur User_name = @par1)"; Program.cmd.Parameters.AddWithValue("@par1", comboBox1.Text);Code
Program.cmd.ExecuteNonQuery ();Code
the same problem in deleteCode
Program.cmd.CommandText = "delete from autorisation where Id_user = (select top 1 utilisateur User_name = @par1)"; Program.cmd.Parameters.AddWithValue("@par1", comboBox1.Text);Code
Program.cmd.Parameters.AddWithValue("@del", comboBox1.Text);Code
Program.cmd.ExecuteNonQuery();Code
In short how to do the deletion and modification without writing in the clause where Id_autorisation = ....Code
And thanks in advance friends
Nilesh ShahRank #42 · 34.2K reputationPosted May 1, 2017, 6:23 AM EDT
ma oumlRank #3,005 · 479 reputationPosted May 1, 2017, 9:29 AM EDT
Nilesh ShahRank #42 · 34.2K reputationPosted May 1, 2017, 11:18 AM EDT
ma oumlRank #3,005 · 479 reputationPosted May 1, 2017, 11:25 AM EDT
ma oumlRank #3,005 · 479 reputationPosted May 1, 2017, 11:27 AM EDT
Nilesh ShahRank #42 · 34.2K reputationPosted May 1, 2017, 12:42 PM EDT
ma oumlRank #3,005 · 479 reputationPosted May 1, 2017, 12:57 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts