TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ma ouml
NA
436
88.9k
How to edit and delete in sql server
May 1 2017 6:29 PM
Hi friends
I will post another old publication
I hope I find someone who can help me
This is my problem
I have a problem is that I had a table named authorisation 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
update ===>
Program.cmd.CommandText="update autorisation set Id_site = (select top 1 Id_site from site where Libelle_site = '"+comboBox2.Text+"') , Id_user = (select top 1 Id_user from utilisateur where User_name = '"+comboBox1.Text+"') , Id_profil = (select top 1 Id_profil from profil where Libelle_profil = '"+comboBox3.Text+"') where Id_user = (select top 1 Id_user from utilisateur where User_name = @par1)";
Program.cmd.Parametrers.AddWithValue("@par1",comboBox1.Text);
Program.cmd.ExecuteNonQuery();
delete ====>
Program.cmd.CommandText = "delete from autorisation where Id_user = (select top 1 Id_user from utilisateur where User_name = @par2)";
Program.cmd.Parametrers.AddWithValue("@par2",comboBox1.Text);
Program.cmd.ExecuteNonQuery();
How to modify and delete without specifying in the where clause the id of the current table
Is there is another method for editing and deleting without working with Id_autorisation
thanks for advance
Reply
Answers (
4
)
How to edit and delete in sql server
Question about Mysql workbench