Hello, I’m putting together a .net application that uses excel as its database. I’m trying to get my application update records in the excel database. I’m able to read data from the database using my application so it’s setup correctly. Can someone please assist me with this? When I run my application I’m getting “Unable to Submit” (My error). It might be my syntax and I’m not sure how to code the Comm.Command.text = Update…. Command. Please see my code below.
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles SubmitTime.Click
If Not TotalHrs.Text = "" Then
Dim Conn As New OleDbConnection
Dim Comm As New OleDbCommand
Conn.ConnectionString = CreateConnString("c:\Data\TimeData.xls")
Comm.Connection = Conn
Comm.CommandText = "update [TimeData$] set '" & ComboBox1.Text & "'='" & TotalHrs.Text & "' where Ename = '" & EmpName.Text & "'"
MsgBox("Time Submitted Sucessfully.")
Catch ex As Exception
MsgBox("Unable to Submit.")
MsgBox("Please calculate your time before submitting")