Retrieving & Updating an Access Database

For some reason (By even using the DataForm Wizard) I am unable to update an Access database from .NET
I use the OLE JET 4.0 Provider and a Microsoft Access 2003 database.
I can get my programs to add a blank record, but not any actual data.
Why is this happening?

Please include examples and explainations
LVL 1
Andrew StillwellAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bchoorCommented:
Check this out http://www.startvbdotnet.com/ado/msaccess.aspx

Basically,

' 1. Create your OleDB connection
Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\yourDBPath\yourDB.mdb;"
Dim conn as New OleDbConnection(connString)

' 2. Let's say you want to insert a record in Table (tblCustomers {customer_id(PK), customerName})
' for this you can use an OleDbCommand
Dim cmd As New OleDbCommand("INSERT INTO tblCustomers (customerName) VALUES ('John Smith')", Conn)

' 3. Now execute the command
Try
  Conn.Open()
  cmd.ExecuterNonQuery()
Catch Ex As Exception
  MessageBox.Show(Ex.Message)
Finally
  Conn.Close()
End Try

HTH
~BC
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bob LearnedCommented:
Are you getting any exceptions?  Are you using a DataAdapter?  Are you calling the Update?

Bob

0
Andrew StillwellAuthor Commented:
TheLearnedOne:

This is my code for filling the dataset
            OleDbDataAdapter1.SelectCommand.Parameters("GSFEquipNo").Value = txtboxGSFEquipNo.Text
            OleDbDataAdapter1.Fill(DsFreon1)

This is my code for updating

            Me.BindingContext(DsFreon1, "Freon").EndCurrentEdit()
            Me.BindingContext(DsFreon1, "Freon").AddNew()

            OleDbDataAdapter1.Update(DsFreon1.Tables("Freon"))
            DsFreon1.AcceptChanges()

What is wrong with this?  I've never had such problems with SQL Server; why is an Access database so different?
0
Bob LearnedCommented:
That's because Access sucks *GRIN*  Are you getting an exception?

Did you think about SQL Server 2005 Express?  It's free.

Bob
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.