Solved

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

Posted on 2008-10-06
9
210 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 

Author Comment

by:JPTenore
ID: 22657117
WiFi went down, let me catch up
0
 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 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