Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

getting error in sql string with union

$
0
0

Dear all

I want to insert data in two tables and made a sql string with insert statement for each table and want to use UNION to insert data to two tables at a time but I am getting syntax error in INSERT INTO statement. My sql string codes are as below Pl let me know the correct formation of sql statement using UNION for INSERT INTO statement.

 Sql = "(INSERT INTO ORDERS (OrderID, CustID, Product, UnitPrice, Quantity, Discount) Values(@OrderID, @CustID, @Product, @UnitPrice, @Quantity, @Discount);) UNION " + _"(INSERT INTO CUSTOMERS (CustID, Company, FirstName, LastName, phone, ) Values(@CustID, @Company, @FirstName, @LastName, @phone, @);)"
Sunilsb
  


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>