Click here to Skip to main content
15,896,359 members

Delete row from two sql tables that join together

Revision 1
There are two tables:

VB
Table1 : UserID Name Job
Table2 : BookID Book Car UserID


I load these two tables in one wpf datagrid:

C#
da.SelectCommand = new SqlCommand("select Table1.UserID, Table1.Name, Table1.Job, Table2.Book, Table2.Car from Table1 inner join Table2 on Table1.UserID = Table2.UserID");


I want to delete one row from Table2 by DataGrid:

C#
SqlCommand com = new SqlCommand("delete from Table2 where BookID=@BookID)",con);


but not work,

How can I do it?
Posted 19-Jan-13 17:54pm by M.H. Shojaei.
Tags: , ,