- Messages
- 15
- Reaction score
- 0
- Points
- 16
sir may eror po akong nakukuha ang error po ay:
Syntax error in INSERT INTO statement.
i think ppo sir may prob ako sa data access
eto po yung code ko:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
connect()
If Me.cboSec.Text = "" Then
MsgBox("Pls Choose Your Section", MsgBoxStyle.Information, "Invalid")
Me.cboSec.Focus()
ElseIf Me.cboDay.Text = "" Then
MsgBox("Pls Choose The Date", MsgBoxStyle.Information, "Invalid")
Me.cboDay.Focus()
ElseIf Me.cboSubjCode.Text = "" Then
MsgBox("Pls Choose Your Subject Code", MsgBoxStyle.Information, "Invalid")
Me.cboSubjCode.Focus()
ElseIf SubN.Text = "" Then
MsgBox("Enter Sub Name", MsgBoxStyle.Information, "Invalid")
Me.SubN.Focus()
ElseIf cboU.Text = "" Then
MsgBox("Pls Enter Units", MsgBoxStyle.Information, "Invalid")
Me.cboU.Focus()
ElseIf Me.txtTime.Text = "" Then
MsgBox("Enter Time Wtf", MsgBoxStyle.Information, "Invalid")
Me.txtTime.Focus()
ElseIf txtRoom.Text = "" Then
MsgBox("Enter Enter Room", MsgBoxStyle.Information, "Invalid")
Else
rs.Open("select * from tblSched where FacultyID = " & Me.cboFacid.Text & "", con, 3, 3)
If rs.RecordCount = 0 Then
rs.Close()
rs.Open("insert into tblSched(FacultyID, subjectID, day, time, room), values (" & Me.cboFacid.Text & ", " & Me.cboSubjCode.Text & ", '" & Me.cboDay.Text & "', '" & Me.txtTime.Text & "', '" & Me.txtRoom.Text & "')", con, 3, 3)
MsgBox("Record Added", MsgBoxStyle.Information, "Added")
End If
End If
con.Close()
End Sub
TYpo
Syntax error in INSERT INTO statement.
i think ppo sir may prob ako sa data access
eto po yung code ko:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
connect()
If Me.cboSec.Text = "" Then
MsgBox("Pls Choose Your Section", MsgBoxStyle.Information, "Invalid")
Me.cboSec.Focus()
ElseIf Me.cboDay.Text = "" Then
MsgBox("Pls Choose The Date", MsgBoxStyle.Information, "Invalid")
Me.cboDay.Focus()
ElseIf Me.cboSubjCode.Text = "" Then
MsgBox("Pls Choose Your Subject Code", MsgBoxStyle.Information, "Invalid")
Me.cboSubjCode.Focus()
ElseIf SubN.Text = "" Then
MsgBox("Enter Sub Name", MsgBoxStyle.Information, "Invalid")
Me.SubN.Focus()
ElseIf cboU.Text = "" Then
MsgBox("Pls Enter Units", MsgBoxStyle.Information, "Invalid")
Me.cboU.Focus()
ElseIf Me.txtTime.Text = "" Then
MsgBox("Enter Time Wtf", MsgBoxStyle.Information, "Invalid")
Me.txtTime.Focus()
ElseIf txtRoom.Text = "" Then
MsgBox("Enter Enter Room", MsgBoxStyle.Information, "Invalid")
Else
rs.Open("select * from tblSched where FacultyID = " & Me.cboFacid.Text & "", con, 3, 3)
If rs.RecordCount = 0 Then
rs.Close()
rs.Open("insert into tblSched(FacultyID, subjectID, day, time, room), values (" & Me.cboFacid.Text & ", " & Me.cboSubjCode.Text & ", '" & Me.cboDay.Text & "', '" & Me.txtTime.Text & "', '" & Me.txtRoom.Text & "')", con, 3, 3)
MsgBox("Record Added", MsgBoxStyle.Information, "Added")
End If
End If
con.Close()
End Sub
TYpo