-
Sep 16th, 2021, 09:52 AM
#1
Thread Starter
Lively Member
[RESOLVED] Update Statement - DatagridView
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!
-
Sep 16th, 2021, 09:59 AM
#2
Re: Update Statement - DatagridView
This is invalid syntax for an update statement, remove it:
Code:
(flattype, units, rentamt, vacant, tenantregID)
This is likely an artifact from copying/pasting an insert statement.
-
Sep 16th, 2021, 10:46 AM
#3
Thread Starter
Lively Member
Re: Update Statement - DatagridView
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|