I am converting my VB6 code to VB.Net. I am using VS2015 Community edition.
I had a handy Function in my VB6 code called "GetReadWriteRecordset". In my form code I could create a SQL Query and pass that to my routine. I used this extensively having only to change the SQL code in whatever part of the program calling the function. I could then update/insert/ delete the record/records returned, as needed.
e.g.
I am not sure how to declare the recordset as an adodb recordset or if it is possible.Code:Dim rs As ADODB.Recordset Dim sSQL As String, bSuccessful As Boolean sSQL = "SELECT [table].[ProductCode], [table].[Quantity], [table].WarehouseCode " & _ "From [table] " & _ "WHERE ((([table].ProductCode)= '" & sProdCode & "' ) " & _ "AND (([table].WarehouseCode)= '" & sWhseCode & "' )) " Set rs = GetReadWriteRecordset(sSQL, bSuccessful) If bSuccessful Then rs![QuantityOnOrder] = rs![QuantityOnOrder] - (dblQtyOrd - dblQtyRec) If rs![QuantityOnOrder] < 0 Then rs![QuantityOnOrder] = 0 End If rs.Update End If Exit Sub
Any help will be appreciated.


Reply With Quote
