Bonjour à tous,
Mon code est le suivant:
<%@ Page Language="C#" %>
<%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI" Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral, PublicKeyToken=6f763c9966660626" %>
<%@ import Namespace="System.Reflection" %>
<%@ import Namespace="System.Collections" %>
<%@ import Namespace="LibrairiesWeb" %>
<%@ import Namespace="Microsoft.Data.Odbc" %>
<script runat="server">
private OdbcConnection mConnexion;
private void OpenDatabase()
{
try
{
string nomBase = "CertificatsCadeaux";
string m_connStr = "DSN=" + nomBase + ";";
mConnexion = new OdbcConnection(m_connStr);
mConnexion.Open();
}
catch(OdbcException e)
{
throw new Exception(e.Message + "****" + e.StackTrace, e);
}
}
private void CloseDatabase()
{
mConnexion.Close();
mConnexion.Dispose();
mConnexion = null;
}
public ArrayList ObtenirListeCategories()
{
ArrayList listeCat = new ArrayList();
try
{
OpenDatabase();
string requete = "SELECT nom FROM Categories";
OdbcCommand commande = new OdbcCommand(requete, mConnexion);
// Exécution
OdbcDataReader rslt = commande.ExecuteReader();
while(rslt.Read())
{
listeCat.Add(rslt.GetString(0));
}
}
catch(Exception exc)
{
throw new Exception(exc.Message, exc);
//MessageBox.Show(exc.Message);
}
finally
{
CloseDatabase();
}
return listeCat;
}
private void Charger(Object Sender, EventArgs E)
{
ArrayList listeCat = null;
try
{
listeCat = ObtenirListeCategories();
}
catch(Exception exc)
{
Label1.Text = exc.Message + "\n" + exc.StackTrace;
}
//return listeCat;
}
</script>
Mais la connexion ne se fait pas
Erreur :
Source de données introuvable ou nom de pilote non spécifié
Est-ce
que cela peut venir du web.config
J'ai pas vraiment d'idées
Merci