Trying to Insert a Record

Discussion in 'ASP .Net' started by Curt Emich, May 7, 2004.

  1. Curt Emich

    Curt Emich Guest

    I'm trying to insert a new record into an MS Access table. The code below
    compiles and runs, but it doesn't write a record into the table. Can
    someone tell me why?

    Dim thisSelectCommand As New OleDb.OleDbCommand("SELECT * FROM Sessions",
    Me.OleDbConnection1)

    Dim thisDataAdapter As New OleDb.OleDbDataAdapter(thisSelectCommand)

    Dim thisDataset As New System.Data.DataSet()

    thisDataAdapter.Fill(thisDataset, "Sessions")

    thisDataAdapter.InsertCommand = New OleDb.OleDbCommand("INSERT INTO Sessions
    (Notes) VALUES('Yadda')")

    thisDataAdapter.Update(thisDataset, "Sessions")

    thisDataset.AcceptChanges()
     
    Curt Emich, May 7, 2004
    #1
    1. Advertising

  2. this another solution to add record
    ---------------
    Dim thisinsDataAdapter As OleDb.OleDbDataAdapte
    Dim thisinsDataset As New System.Data.DataSet(
    thisinsDataAdapter= New OleDb.OleDb.OleDbDataAdapter("INSERT INTO Session
    (Notes) VALUES('Yadda')"
    thisinsDataAdapter(thisinsDataset, "Sessions"

    and you can refresh you 1st dataset again

    hope it help u
    Manj
     
    =?Utf-8?B?TWFuamE=?=, May 7, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SnVzdGlu?=

    Retrieving Record Key while creating the record.

    =?Utf-8?B?SnVzdGlu?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    648
    =?Utf-8?B?SnVzdGlu?=
    Oct 5, 2004
  2. André
    Replies:
    0
    Views:
    3,761
    André
    Jun 25, 2006
  3. MRW
    Replies:
    0
    Views:
    391
  4. Frits van Soldt

    How to insert a new record in detailsview when there are no record

    Frits van Soldt, Nov 16, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    782
    Frits van Soldt
    Nov 17, 2005
  5. Guest
    Replies:
    1
    Views:
    272
    Alex G
    Jan 9, 2004
Loading...

Share This Page