Hi all
I am tray to execute multiple SQL statements using a SqlCommand, but it gave me error :
there was an error parsing the query. [token line number = 1, token line offset = 150, token in error = insert]
What does it mean? and how can i solve it?
my code :
the curse code from here : http://www.java2s.com/Tutorial/CShar...mandobject.htm
I am tray to execute multiple SQL statements using a SqlCommand, but it gave me error :
there was an error parsing the query. [token line number = 1, token line offset = 150, token in error = insert]
What does it mean? and how can i solve it?
my code :
Code:
Dim con As New SqlCeConnection
Dim cmd As New SqlCeCommand
Try
con.ConnectionString = "Data Source=|DataDirectory|\db1.sdf"
con.Open()
cmd.Connection = con
cmd.CommandText = "INSERT INTO ShortGoalsP (NonKnownSkill,IDShortGoal,ShortGoalP,IDStudent) " +
"SELECT Skill,IDShortGoal,ShortGoal, @parameter " +
"FROM ShortGoals " + "WHERE YorN=1;" +
"INSERT INTO DailyGoalsP (IDShortGoalP,DailyGoalP,IDStudent) " +
"SELECT IDShortGoal,DailyGoal,@parameter " + "FROM DailyGoals " +
"WHERE YorN=1;"
cmd.Parameters.Add("@parameter", SqlDbType.Int).Value = CInt(TextBox1.Text)
cmd.ExecuteNonQuery()
cmd.CommandText = "UPDATE ShortGoals SET YorN=NULL; " + "UPDATE DailyGoals SET YorN=NULL; "
cmd.ExecuteNonQuery()
MsgBox("successful")
Catch ex As Exception
MessageBox.Show("not successful"& ex.Message)
Finally
con.Close()
End Try