Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21238

[RESOLVED] help: update table

$
0
0
Code:



Private Sub Command1_Click()
    Dim loadrs As ADODB.Recordset
    Dim loadcn As ADODB.Connection
   
    Dim loaddbcon As New DLLConnectionFunction
    Set loaddbcon = New DLLConnectionFunction

    If loaddbcon.ConnectDBMsSQLOLEDB2005(loadcn, "localhost", "inventory", "sa", "password") = True Then
        Dim strsql As String
        strsql = "select * from testview"
       
        If loaddbcon.ConnectRS(loadcn, loadrs, strsql, rsadOpenStatic, rsadLockPessimistic) = True Then

        loadrs.MoveFirst
        Do Until loadrs.EOF
               
        Dim str As String
        str="Update tbinvent " & _
        "Set Markup_Out=200, " & _
        "Markup_In=200, " & _
        "SellingPriceOut=(2 * loadrs.fields("listcost"))+ loadrs.fields("listcost")), " & _
        "SellingPriceIn=(2 * loadrs.fields("listcost"))+ loadrs.fields("listcost")) " & _
        "where itemid=loadrs.fields("itemid") "

        loadrs.MoveNext
        Loop
        MsgBox "Done"
       
    End If
End Sub

that is my code and I am getting error expected end of statement.

Basically, I just need to update the selling price.

Please help correct my code. Thank you
Attached Images
 

Viewing all articles
Browse latest Browse all 21238

Trending Articles



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