Solved

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

Posted on 2008-10-06
9
208 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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 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