Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

Update Two Tables

$
0
0

Hopefully I have the right forum, but here is the situation.

I am using Visual Basic 2010 and SQL Server 2005 Express and the program is basically an inventory maintenance.

If the User lends a Book from his collection this is recorded on a Books table and a Loan table. The SQL Server procedure is:

INSERT INTO tblLoaned(IsOnLoan,Collection,CollectionID,Title,LoanDate,LoanTo,Cost,PhoneNumber,LoanComments)

VALUES(@IsOnLoan, @Collection, @CollectionID, @Title, @LoanDate, @LoanTo, @Cost, @PhoneNumber, @LoanComments)

SELECT MAX(LoanID) AS ID
FROM tblOnLoan

UPDATE tblBooks SET IsOnLoan=@IsOnLoan,LoanID=ID,LoanTo=@LoanTo,LoanDate=@LoanDate;

The SQL Server accepts this Stored Procedure and does not throw an error when I Parse and Execute  the code in the SSMS program.  My problem is that I cant figure out (simply don't know how to) update a table and insert another table with a single set of instructions in my Visual Basic program.

Can anyone help?

Milt


sirmilt


Viewing all articles
Browse latest Browse all 21115

Trending Articles



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