Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Retrieving & Updating an Access Database

Posted on 2006-03-27
5
Medium Priority
?
250 Views
Last Modified: 2010-05-18
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
0
Comment
Question by:enlightec
5 Comments
 
LVL 10

Accepted Solution

by:
bchoor earned 600 total points
ID: 16306023
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16306914
Are you getting any exceptions?  Are you using a DataAdapter?  Are you calling the Update?

Bob

0
 
LVL 1

Author Comment

by:enlightec
ID: 16315293
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
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 450 total points
ID: 16315327
That's because Access sucks *GRIN*  Are you getting an exception?

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

Bob
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question