Where is the syntax error in my Insert statement?

  • Thread starter Thread starter svampeb0b
  • Start date Start date
S

svampeb0b

Guest
It says that there is a syntax error in my insert statement, pointing to the .ExecuteNonQuery() at the end:

Defining the activity ID from the datatable
Dim ActivityID As Integer = DataTableActivities.Rows(0).Item(0)
Defining the calories from the datatable
Dim calories As Decimal = (DataTableActivities.Rows(0).Item(3)) * (DurationNum.Value / 60)
Insert statement to add new training events
Dim SqlQueryActivityInsert As String = "INSERT INTO tblTraining (RunnerID, ActivityID, Full_Name, Time, Calories_Burnt, Date) VALUES (@RunnerID, @ActivityID, @Full_Name, @Time, @Calories, @Date)"
Dim SqlCommandActivity As New OleDbCommand
With SqlCommandActivity
.CommandText = SqlQueryActivityInsert
.Parameters.AddWithValue("@RunnerID", LoginForm.UserIDlbl.Text)
.Parameters.AddWithValue("@ActivityID", ActivityID)
.Parameters.AddWithValue("@Full_Name", LoginForm.Full_Namelbl.Text)
.Parameters.AddWithValue("@Time", DurationNum.Value)
.Parameters.AddWithValue("@Calories", calories)
.Parameters.AddWithValue("@Date", WeekPicker.Value)
.Connection = conn
.ExecuteNonQuery()

Continue reading...
 
Back
Top