Tuesday, March 10, 2009

Read record from microsoft access 2007 database on Visual Studio 2008 (VB.NET 2008)

Visual Studio 2008 it's different from Visual Basic 6.0 or below.So it have own code to read record in database.

Usually people use Microsoft.Jet.OLEDB.4.0 as provider. But it just can read MS Access 2003 database.it can't read MS access 2007 database. In visual studio 2008, it use Microsoft.ACE.OLEDB.12.0 as provider. it can read MS access 2007 database.

I have code to read record from microsoft access 2007 database.
You just have to following this steps:

For an example I have made a MS Access 2007 database called "Database1" with a table named "Tbl1".In Tbl1 there are 3 index ("Suhu", "Viscosity", and "Density") and 31 rowsI placed the database in My document diractory.

After that Open Visual Studio 2008 and make a new project in that projectmake a form with One Textbox and Two Label.

Then write this code below:


In Rec.Find i use "-30" for skip record (Default value is "0"). I use 30 because there is 31 rows in "Tbl1".Interpolasi is use for if X record not found.So it will use interpolation calculating the record to find the Y record.

No comments:

Post a Comment