Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15064

[RESOLVED] Update Statement - DatagridView

$
0
0
Hi,

In the Update Statement code - I receive the error message:

Incorrect Syntax near 'flattype'



Code:

For i As Integer = 0 To DgUnitsUp.Rows.Count - 1 Step +1

                query = "UPDATE dbo.tblunits SET flattype=@flattype, units=@units, rentamt=@rentamt, vacant=@vacant, tenantregID=@tenantregID (flattype, units, rentamt, vacant, tenantregID) WHERE propertyID=@propertyID and unitID=@unitID"
                cmd = New SqlCommand(query, conn1)

                cmd.Parameters.AddWithValue("@flattype", DgUnitsUp.Rows(i).Cells(6).Value.ToString())
                cmd.Parameters.AddWithValue("@units", DgUnitsUp.Rows(i).Cells(1).Value.ToString())
                cmd.Parameters.AddWithValue("@rentamt", DgUnitsUp.Rows(i).Cells(2).Value.ToString())
                cmd.Parameters.AddWithValue("@vacant", DgUnitsUp.Rows(i).Cells(3).Value.ToString())
                cmd.Parameters.AddWithValue("@tenantregID", DgUnitsUp.Rows(i).Cells(4).Value.ToString())
                cmd.Parameters.AddWithValue("@propertyID", DgUnitsUp.Rows(i).Cells(0).Value.ToString())
                cmd.Parameters.AddWithValue("@UnitID", DgUnitsUp.Rows(i).Cells(9).Value.ToString())


                cmd.ExecuteNonQuery()

            Next

Any help will be appreciated!

Viewing all articles
Browse latest Browse all 15064

Trending Articles



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