Solved

I have 4 FoxPro Tables and 3 MS Access I need to Read Records in Tables

Posted on 2008-10-06
9
206 Views
Last Modified: 2012-05-05
I have the data driver for FoxPro Installed.

I am using OLEDB so it doesn't matter the Database type.

I have 2 DataSet generated graphically.  (one for FoxPro and the other  Access)
 I would like to write code only (or maybe use code with the 2 graphically generated DataSets)


Steps I think I need:
Connection
DataSet
TableAdapter
Advance Record
Specify Field with String, not hard coded (i.e. strMyField = recRecord(strField))
0
Comment
Question by:JPTenore
  • 5
  • 4
9 Comments
 

Author Comment

by:JPTenore
ID: 22656110
Back in 30mins
0
 

Author Comment

by:JPTenore
ID: 22656826
No Comments Yet?!?  Maybe if I Break it up?
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 22657045
FoxPro tables can come in either of two formats. They can be "free" tables, meaning that each table is independent of the others, or they can be part of a "database container" which holds metadata and allows additional features for the tables. If you see a file with a DBC extension then you've got a database.

Here are two connection strings:

*-- Free table directory
Provider=VFPOLEDB.1;Data Source=C:\My Documents\Visual FoxPro
Projects;Password="";Collating Sequence=MACHINE

*-- Database Container
Provider=VFPOLEDB.1;Data Source=C:\My Documents\Visual FoxPro
Projects\Test.DBC;Password="";Collating Sequence=MACHINE

(http://www.connectionstrings.com/)
 Using connection as new OleDbConnection("Provider=VFPOLEDB.1;Data Source=C:\My Documents\Visual FoxPro Projects;Password='';Collating Sequence=MACHINE")

     connection.Open()

     ' Use the connection

 End Using

Open in new window

0
 

Author Comment

by:JPTenore
ID: 22657117
WiFi went down, let me catch up
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:JPTenore
ID: 22657135
That Answers one Question I have Posted.  Also the FroPro data is 'Free Table'

Ask a Question for each step

Steps I think I need:
Connection (3 Questions for each Access, FoxPro, SQL Server)
DataSet
TableAdapter
Advance Record
Specify Field with String, not hard coded (i.e. strMyField = recRecord(strField))


You just got Connection - FoxPro (Hold on I will ask it)
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 22657153
1. Connections:
- A. Foxpro (OLEDB)
Provider=VFPOLEDB.1;Data Source=C:\My Documents\Visual FoxPro Projects;Password="";Collating Sequence=MACHINE
- B. Access  (OLEDB)
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=;
http://connectionstrings.com/?carrier=access
- C. SQL-server (SQLConnection)
Data Source=myServerAddress;Initial Catalog=myDataBase;User  Id=myUsername; Password=myPassword;
http://connectionstrings.com/?carrier=sqlserver2005
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 22657156
2. Filling a dataset

Filling a DataTable or DataSet the Quick Way
http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=406
private DataTable GetDataTable()

{

  string sql = "SELECT Id, Description FROM MyTable";

  using (SqlConnection myConnection = new SqlConnection(connectionString))

  {

    using (SqlCommand myCommand = new SqlCommand(sql, myConnection))

    {

      myConnection.Open();

      using (SqlDataReader myReader = myCommand.ExecuteReader())

      {

        DataTable myTable = new DataTable();

        myTable.Load(myReader);

        myConnection.Close();

        return myTable;

      }

    }

  }

}		

Open in new window

0
 

Author Comment

by:JPTenore
ID: 22657157
Here is the Question you Answered  ID:23792892   500pts. A Grade just post last Comment there
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
ID: 22657170
4. Loop datatable

        Dim dr As DataRow

        For Each dr In ds.Tables(0).Rows

            Dim i As Integer

            For i = 1 To ds.Tables(0).Columns.Count

                Console.Write("{0,15}", dr(i - 1))

            Next i

            Console.Write(vbCrLf)

        Next

Open in new window

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now