Hi, not sure if this is the correct forum to post at. Recently I have tried to used Visual Web developer 2008 to code my stuff but I have a problem on the following inserting command code.
During debugging, its free from errors, but when I press the button, nothing goes into the database. Can anyone enlighten me? Here is my code.
----------------------------------------------------------
Imports System.Data.OleDb
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub ButtonAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim Mycn As OleDbConnection
Dim Command As OleDbCommand
Dim SQLstr As String
Mycn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Kenji Teo\My Documents\IssueLog.mdb;")
Mycn.Open()
SQLstr = "INSERT INTO IssueLog (EmpName) VALUES('" & txtName.Text & "')"
Command = New OleDbCommand(SQLstr, Mycn)
Mycn.Close()
End Sub
End Class
During debugging, its free from errors, but when I press the button, nothing goes into the database. Can anyone enlighten me? Here is my code.
----------------------------------------------------------
Imports System.Data.OleDb
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub ButtonAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim Mycn As OleDbConnection
Dim Command As OleDbCommand
Dim SQLstr As String
Mycn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Kenji Teo\My Documents\IssueLog.mdb;")
Mycn.Open()
SQLstr = "INSERT INTO IssueLog (EmpName) VALUES('" & txtName.Text & "')"
Command = New OleDbCommand(SQLstr, Mycn)
Mycn.Close()
End Sub
End Class