Click to See Complete Forum and Search --> : Access .MDB database connection problem


Zircomfp
May 31st, 2005, 11:41 AM
Hello,
I just want to make a simple datagrid show the information held into an MsAccess database but only 1 row shows into it... what's more, when I debug I can't seem to see the information held into my dataSet using Visual Studio's spy. Here is my VB code



Dim cnnConnection As New OleDbConnection()
Dim daCatalogue As New OleDbDataAdapter()
Dim dsCatalogue As New DataSet()


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
cnnConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & Server.MapPath("catalogue.mdb"))
cnnConnection.Open()

If Not IsPostBack() Then
affiche()
End If

Catch exc As Exception
Response.Clear()
End Try
End Sub

Private Sub affiche()
Dim sql
If (language.Equals("EN")) Then
sql = "SELECT noProduit, nomProduit, dimensions, prix, descriptionEN FROM tCatalogue"
Else
sql = "SELECT noProduit, nomProduit, dimensions, prix, descriptionFR FROM tCatalogue"
End If

daCatalogue = New OleDbDataAdapter(sql, cnnConnection)
daCatalogue.Fill(dsCatalogue, "tCatalogue")

viewstate("sql") = dsCatalogue
dgCatalogue.DataSource = dsCatalogue.Tables("tCatalogue").DefaultView
dgCatalogue.DataBind()
End Sub


Could it be a problem with my database?
Thanks!