cs_nosil
Messages postés
37
Date d'inscription
dimanche 20 juin 2004
Statut
Membre
Dernière intervention
20 octobre 2005
12 août 2005 à 16:02
J'ai tjrs un probleme avec mon acces a ma base de donnee.
Est-ce que qq'un pourrait m'aider?
Mon code de connection:
private void fnGetConnectedToDatabase()
{
string
conStr = @"Driver={Microsoft Paradox Driver (*.db )};DriverID=538;
Fil=Paradox5.X;
DefaultDir=\\Sql01\Winware\Auftrag\DATEN\MVORLAGE;
Dbq=\\Sql01\Winware\Auftrag\DATEN\MVORLAGE\;CollatingSequence=ASCII";
try
{
//open the connection to the database
myConn = new OdbcConnection(conStr);
myConn.Open();
}
catch (OdbcException ex)
{
MessageBox.Show("Error in connection ..." + ex.Message);
}
try
{
string sqlStr = "SELECT * FROM KUNDEN;";
//Instantiate a DataAdapter by passing the sqlStr and Connection.
//now data is in raw form
dAdapter = new OdbcDataAdapter(sqlStr, myConn);
//Instantiate a DataSet
dset = new DataSet();
//Gets a collection that provides the master mapping
// between a source table and a DataTable
//dAdapter.TableMappings.Add("Table", "Adresse");
/*A data adapter object utilizes the Fill method
to populate a DataSet or a DataTable object with data
retrieved by a SELECT command. */
dAdapter.Fill(dset);
//When binding a DataSet, .NET automatically uses the corresponding
//DataViewManager provided through the DataSet.DefaultViewManager
property
this.dviewmanager = dset.DefaultViewManager;
this.listBox1.DataSource = this.dviewmanager;
//display "studentTable.StudentID" in the ComboBox
this.listBox1.DisplayMember = "KUNDEN.Name";
// Close the connection to the database.
this.myConn.Close();
}
catch (Exception e)
{
MessageBox.Show("Error in sql query " + e.Message);
}
}
}
Apparamment la connection passe, mais apres il me met une erreur :
"Erreur in sql query ERROR [HY000][Microsoft][pilote ODBC Paradox] La table externe n'est pas dans le format attendu."
Voila,
A L'AIDE !!!!!