Current location: Hot Scripts Forums » Programming Languages » Visual Basic » MS Access DB not updated


MS Access DB not updated

Reply
  #1 (permalink)  
Old 06-28-04, 04:20 PM
simplyVB simplyVB is offline
New Member
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
MS Access DB not updated

MSACCESS database : school.mdb
tablename : student
databaseconnection type : ODBC

created connection,dataAdapter,dataset

scrolled tru the data and pops data in messagebox

So far so good.

Tried creating new row
dataset.AcceptChanges
myDataAdapter.update

No row appended in ms access database.

Any CLUE ????

tried OleDBConnection no luck.

tried direct database command INSERT...... works.

here is the code. Is anything wrong with datasets ???


Dim conn As New System.data.Odbc.OdbcConnection
Dim myCommand As System.Data.Odbc.OdbcDataAdapter
Dim dataset1 As DataSet = New DataSet
Dim myTable As DataTable
Dim myRow As DataRow
Dim myColumn As DataColumn
Dim newRow1 As DataRow


conn.ConnectionString = "FIL=MS Access;DSN=SchoolDSN"
conn.Open()

myCommand = New System.Data.odbc.OdbcDataAdapter("select * from student", conn)
myCommand.Fill(dataset1)

For Each myTable In dataset1.Tables
For Each myRow In myTable.Rows
For Each myColumn In myTable.Columns

MessageBox.Show(myRow(myColumn))
Next
Next
Next

newRow1 = myTable.NewRow
newRow1(0) = "newman"
newRow1(1) = 34247

myTable.Rows.Add(newRow1)

dataset1.AcceptChanges()

myCommand.Update(dataset1)


MessageBox.Show("so far so good")
conn.Close()


thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Access Database? jakeisbland JavaScript 1 06-03-04 06:46 PM
Posting MS Access contents on the Windows Desktop sandeep_mankoo ASP 1 05-09-04 12:14 AM
ASP and MS Access sireen1980 ASP.NET 1 04-25-04 07:12 PM
Posting contents of MS Access databse to Windows Desktop sandeep_mankoo JavaScript 1 04-19-04 06:13 AM
Coverting MS Access database to Text file sandeep_mankoo ASP 0 04-17-04 09:48 AM


All times are GMT -5. The time now is 07:31 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.