I added an SQL insert statement to a button on my web form and when I
debug I get the error: "Incorrect syntax near ','  "  I've been over
and over the code and can't figure out the problem.  Could someone
please take a look at my code and let me know if you see anything
wrong?

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
        Dim oConn As New
System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("CMSConnectionString").ConnectionString)
        Dim cmd As New System.Data.SqlClient.SqlCommand()
        cmd.Connection = oConn
        oConn.Open()
        cmd.CommandText = "INSERT into
Timecard(INEENO,INDTWE,INWKNO,INDYWK, INJBNO, INGLAN, INJCDI, INRGHR,
INOVHR, INOTHR, INOTTY) values(" & EmplID1.Text & ",'" &
DatePicker1.TextValue & "'," & DD_week.Text & "," & DD_DayofWeek.Text
& ",'" & jobno.Text & "','" & GLAcct.Text & "','" & DD_CostCode.Text &
"'," & RegHrs.Text & ", " & OTHrs.Text & "," & OthHrs.Text & ",'" &
DD_OthHourType.Text & "')"
        cmd.ExecuteNonQuery()
        oConn.Close()


    End Sub

Reply via email to