Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help on this VB code (Visual Web Developer) 1

Status
Not open for further replies.

ChoonHong

Programmer
Jul 22, 2003
28
SG
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
 
I think that you are misssing a
Code:
command.execute
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top