I use visual basic 8.0 en MySQL.
I have a connection witho my MySQL database "test" with Myconn.
I have two table's :
Rental
Articlenr Articledis Articlerent
100 beerclass 15
200 wineclass 10
Stock
Articlenr Articledis stock
200 Wineclass 25
So far i have this :
Dim con As New SqlConnection
Dim cmd As New SqlCommand
MYconn.Open()
cmd.Connection = Myconn
cmd.CommandText = "SELECT * FROM rental ORDER BY articlenr"
Dim lrd As SqlDataReader = cmd.ExecuteReader()
i want to go the first record in table rental
While lrd.Read()
*I this loop i want to do the following!!! *
i want to look of the article of rental appears in stock table
Yes, i want update record stock table : stock.stock= stock.stock-rental.Articlerent
No, i want to insert record stock table with the record from the rental table
After this i want to the next record in rental table, until all eof() rental table
End While
Thanks in advance,
Andre