Hallo Buchi,
Hier ein kleiner Code-Schnippsel. Den Pfad zu deiner Datenbank und die
SQL-Anweisung mu�t du nat�rlich anpassen.
Das beispiel verwendet den OleDbDataAdapter.
---------------------------------------------------------------
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%
Dim dbPath As String =
Page.MapPath("../../../asp_shop/database/shop.mdb")
Dim strCnn As String = "provider=Microsoft.Jet.OLEDB.4.0;data
source=" & dbPath
Dim strSQL As String = "SELECT * FROM produkte"
Dim cnn As OleDbConnection = New OleDbConnection(strCnn)
Dim cmd As OleDbDataAdapter = New OleDbDataAdapter(strSQL, cnn)
Dim ds As New DataSet
cmd.Fill(ds)
MyDGrid.DataSource = ds.Tables(0).DefaultView
MyDGrid.DataBind
%>
<asp:DataGrid id="MyDGrid" runat="server"
Width = "500"
BorderWidth = "1"
Font-Name = "Verdana,Geneva"
Font-Size = "8pt"
CellPadding = "1"
CellSpacing = "1"
AlternatingItemStyle-BackColor = "#F7F7DE"
HeaderStyle-ForeColor = "#ffffff"
HeaderStyle-BackColor = "#960101" />
--------------------------------------------------------------------
Du mu�t bei einer Access-Datenbank andere Namespaces als beim SQL Server
verwenden.
F�r SQL: System.Data.SQLClient
F�r OleDb: System.Data.OleDb
Von daher unterscheiden sich nat�rlich auch die Befehle ein wenig
SQLConnection = OleDbConnection
SQLCommand = OleDbCommand
Gru�
Uwe Lyschik
P.S. habe das Beispiel noch unter Beta2 erstellt glaube ich.
Von daher kann ich nicht genau sagen ob es ohne �nderung funktioniert.
| [aspdedotnet] als [email protected] subscribed
| http://www.dotnetgerman.com/archiv/aspdedotnet/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.dotnetgerman.com/listen/aspDEdotnet.asp