hi everyone... this error has been bugging me for a week... can anyone find the error for me... ive been getting an error on the connection on the database... but i see no error on my code... thanks
VB.NET:
Public Function GetConnect()
conn = New OleDbConnection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=InstruIO.mdb"
Return conn
End Function
Private Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
Dim check As Integer
Dim cmdSHEDUGM As New OleDbCommand
Dim daSHEDUGM As New OleDbDataAdapter
Dim dsSHEDUGM As New DataSet
Dim dtSHEDUGM As New DataTable
'Edit
If txtMIndex.Text = "" Then
MsgBox("Data is not completed", MsgBoxStyle.OkOnly)
Else
If MsgBox("Are you sure to edit data with Master Index : " & txtMIndex.Text & " ?", MsgBoxStyle.OkCancel, "Edit confirm") = MsgBoxResult.Cancel Then
' do nothing
Else
Try
conn = GetConnect()
conn.Open()
cmdSHEDUGM = conn.CreateCommand
If remarks.Checked = True Then
remarks.Tag = True
Else
remarks.Tag = False
End If
Dim a As String
a = "UPDATE SHEDUGM SET MASTERINDEX='" & txtMIndex.Text & _
"', SITE='" & txtSite.Text & _
"', PLANT='" & txtPlant.Text & _
"', TAG='" & txtTag.Text & _
"', FLDTAG='" & txtFldtag.Text & _
"', DCSTAG='" & txtDcstag.Text & _
"', AUXTAG='" & txtAuxtag.Text & _
"', CONTAG='" & txtContag.Text & _
"', FLDSYS='" & txtFldsys.Text & _
"', DLSYS='" & txtDlsys.Text & _
"', AUXSYS='" & txtAuxsys.Text & _
"', SERVICE='" & txtService.Text & _
"', FUNCTION='" & txtFunction.Text & _
"', EQUIPTAG='" & txtEquiptag.Text & _
"', OSPAS='" & txtOspas.Text & _
"', IOTYPE='" & txtIotype.Text & _
"', SIGNAL='" & txtSignal.Text & _
"', POWER='" & txtPower.Text & _
"', SOE='" & txtSoe.Text & _
"', IOREDUNDANCY='" & txtIoredundancy.Text & _
"', ENGRANG='" & txtEngrang.Text & _
"', ENGUNIT='" & txtEngunit.Text & _
"', CALRANG='" & txtCalrang.Text & _
"', CALUNIT='" & txtCalunit.Text & _
"', ALARM-HHH='" & txtAlarmhhh.Text & _
"', ALARM-HH='" & txtAlarmhh.Text & _
"', ALARM-H='" & txtAlarmh.Text & _
"', ALARM-LLL='" & txtAlarmlll.Text & _
"', ALARM-LL='" & txtAlarmll.Text & _
"', ALARM-L='" & txtAlarml.Text & _
"', PID='" & txtPid.Text & _
"', PIDSH='" & txtPidsh.Text & _
"', PIDRV='" & txtPidrv.Text & _
"', ILD='" & txtIld.Text & _
"', ILDSH='" & txtIldsh.Text & _
"', ILDRV='" & txtIldrv.Text & _
"', LOGIC='" & txtLogic.Text & _
"', LOGSH='" & txtLogsh.Text & _
"', LOGICRV='" & txtLogicrv.Text & _
"', ECD='" & txtEcd.Text & _
"', ECDSH='" & txtEcdsh.Text & _
"', ECDRV='" & txtEcdrv.Text & _
"', JBNO='" & txtJbno.Text & _
"', CABLE='" & txtCable.Text & _
"', PAIRNO='" & txtPairno.Text & _
"', CABLESPECS='" & txtCablespecs.Text & _
"', FFSEGNO='" & txtFfsegno.Text & _
"', FFLOOPCLASS='" & txtFfloopclass.Text & _
"', IIS='" & txtIis.Text & _
"', NOTES='" & txtNotes.Text & _
"', NOTES1='" & txtNotes1.Text & _
"', ILDLOOP='" & txtIldloop.Text & _
"', ILD-TAGPOS='" & txtIldtagpos.Text & _
"', ILD-STATUS='" & txtIldstatus.Text & _
"', MARSHALLING CABINETS='" & txtMCabinets.Text & _
"' WHERE ID=" & id & ""
cmdSHEDUGM.CommandText = a
'"' , REMARKS='" & remarks.Tag & _
check = cmdSHEDUGM.ExecuteReader.RecordsAffected
MsgBox(a)
If check > 0 Then
MsgBox("Data With Master Index " & txtMIndex.Text & " Succesfully To Edit", MsgBoxStyle.OkOnly, "Info Update Data")
Else
MsgBox("Data With Master Index " & txtMIndex.Text & " Failure To Edit", MsgBoxStyle.OkOnly, "Info Update Data")
End If
'Refresh_Form()
conn.Close()
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
End Try
End If
End If
End Sub