Sysntax error in sql server andasp.net

Manesti

Member
Joined
Jan 16, 2009
Messages
16
Programming Experience
Beginner
I have this code in my page, but I really dont know why I get this error " Incorrect, sysntax error near "o". pkease I need assistance please. thank you

Dim sql As String = "INSERT INTO Offence (offenceCode,route,location,offenceTime,0ffenderID)" _
& " VALUES(@offenceCode,@route,@location,@offenceTime,@offenderID)"

cmd = New SqlCommand(sql, con)
cmd.Parameters.Add("@offenceCode", SqlDbType.VarChar, 50).Value = Code
cmd.Parameters.Add("@route", SqlDbType.VarChar, 50).Value = route
cmd.Parameters.Add("@location", SqlDbType.VarChar, 3).Value = location
cmd.Parameters.Add("@offenceDate", SqlDbType.DateTime, 15).Value = offenceDate
cmd.Parameters.Add("@offenceTime", SqlDbType.VarChar, 50).Value = Time
cmd.Parameters.Add("@offenderID", SqlDbType.Int, 10).Value = ID
' Try
con.Open()
cmd.ExecuteNonQuery()

'Catch ex As Exception
'MsgBox(ex.Message)
'End Try
con.Close()
cmd = Nothing
 
MattP;
I dont know how to thank you, I have looked at dt code 1 million times and did not see it. Thank you and God bless you.
 

Latest posts

Back
Top