my code:
command1.CommandText = "INSERT INTO table1,table2(value1...,value2..)VALUES('" ...... "')"

how to save multiple table is one query? i tried this thing but it didn't work. anyone who can help me with this please..

If I read this correctly, you need to specify the value for both fields in the 2 tables -


I might be wrong though....

You can't use INSERT like this, not even if you use a view.
MSDN says:

table_or view_name
Is the name of the table or view that is to receive the data.

A table variable, within its scope, can be used as a table source in an INSERT statement.

The view referenced by table_or_view_name must be updatable and reference exactly one base table in the FROM clause of the view. For example, an INSERT into a multi-table view must use a column_list that references only columns from one base table. For more information about updatable views, see CREATE VIEW (Transact-SQL).

You can find the whole article here:

You have to either do 2 inserts or use 1 stored procedure that will again do 2 inserts.

hello !
adam_k you are right , rohne0809 you have to use a stored procedure for this .

create proc MyDoubleInsert @parameter1 varchar(50)..........,@ParameterTable2 varchar(50)
insert into table1 values (@ParameterTable1,...........)
insert into table1 values (@ParameterTable2,...........)

exec MyDoubleInsert(value1,value2,.......)

Hope this will helps You

M.Waqas Aslam