Paradox 7 reading in c#

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<img alt="" src="http://social.msdn.microsoft.com/Forums/getfile/108640 <img alt="" src="http://social.msdn.microsoft.com/Forums/getfile/108641 I am having trouble connecting to an old Paradox .db using c#. I can connect to it using a variety of third
party software including my copy of Microsoft Access 2003, but for some reason no matter what variation of the code I use (found around the internet) it doesnt seem to want to work. Any thoughts or ideas would be greatly appreciated, thank you for your time.
Source:<br/>

<pre class="prettyprint using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Odbc;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Paradox
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void btnOpen_Click(object sender, EventArgs e)
{
try
{
DataSet dsRetrievedData = new DataSet();
dataAdapter().Fill(dsRetrievedData);
this.dgvData.DataSource = dsRetrievedData;
this.dgvData.DataMember = dsRetrievedData.Tables[0].TableName;
}
catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error!"); }
}

private OdbcDataAdapter dataAdapter()
{
string _connectionString = @"Provider=MSDASQL;Persist Security Info=False;Mode=Read;Extended Properties=DSN=Paradox;DBQ=C:Masters;DefaultDir=C:Masters;DriverId=538;FIL=Paradox 7.X;MaxBufferSize=2048;PageTimeout=600;;Initial Catalog=C:Masters;";
OdbcConnection _connection = new OdbcConnection(_connectionString);
_connection.Open();
OdbcDataAdapter _dataAdapter = new OdbcDataAdapter("SELECT * FROM WasSamples", _connection);
_connection.Close();
return _dataAdapter;
}
}
}[/code]
<br/>

View the full article
 
Back
Top