Results 1 to 2 of 2

Thread: Trouble in Inserting data into access database

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    5

    Trouble in Inserting data into access database

    Hi

    I am trying to insert some data into access database and couldn't find out what the error was !!!
    The value is not inserted into database .It worked fine till yesterday and dont know why is it failing now?
    Can someone please suggest me what's the problem ???

    the code is

    ***************************************************
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


    Dim myconnection As System.Data.OleDb.OleDbConnection
    Dim mycommand As System.Data.OleDb.OleDbCommand

    Dim strconnect As String = " PROVIDER = Microsoft.Jet.OLEDB.4.0 ;DATA SOURCE = " & _
    Server.MapPath("decisiontree2000.mdb") & ";"
    myconnection = New System.Data.OleDb.OleDbConnection(strconnect)
    myconnection.open()
    Dim strSQL As String

    strSQL = "INSERT INTO CustomerDetails1(UserName) VALUES('" & TextBox1.Text & ")"
    mycommand = New System.Data.OleDb.OleDbCommand(strSQL, myconnection)
    mycommand.ExecuteNonQuery()

    myconnection.Close()

    End Sub
    ************************************************

  2. #2

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    5
    I figured it oout


    It was a synatx error in SQL .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width