.NET
Microsoft Technologies based on the .NET software framework.
4,066 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Receive the above error generated by the code below.
Dim objCommand As SqlCommand = New SqlCommand
Dim Connection1 As New SqlConnection(ConnectionString)
objCommand.CommandText = "UPDATE names " &
"SET n.cc_date = @n.cc_date, n.cpr_date = @n.cpr_date, n.fa_date = @n.fa_date " &
"FROM names n JOIN names2 n2 " &
"WHERE account_no = " & strAccount_No
objCommand.Parameters.AddWithValue("@n.cc_date", datCC_Date.EditValue)
objCommand.Parameters.AddWithValue("@n.cpr_date", datCPR_Date.EditValue)
objCommand.Parameters.AddWithValue("@n.fa_date", datFA_Date.EditValue)
'Open Connection
If Connection1.State = ConnectionState.Closed Then Connection1.Open()
Try
objCommand.ExecuteNonQuery()
Catch SqlExceptionErr As SqlException
MessageBox.Show(SqlExceptionErr.Message)
End Try
'Close connection
If Connection1.State = ConnectionState.Open Then Connection1.Close()
You cannot have . inside the identifier (see rules for SQL variables). You need to rename your parameters to remove . from their names.