Jump to content

connect asp.net with access db


Matar

Recommended Posts

hi im trying to connect an access database with asp.net there are no error but win i run the page i see a blank page , this is the script <%@ Import Namespace="System.Data.OleDb" %><script runat="server">sub Page_Loaddim dbconn,sql,dbcomm,dbread dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source = " & "C:\Inetpub\wwwroot\webdata\log.mdb")dbconn.Open() sql = "SELECT * FROM stu"dbcomm=New OleDbCommand(sql,dbconn)dbread=dbcomm.ExecuteReader()end sub</script><html><body><form id="Form1" runat="server"><asp:Repeater id="customers" runat="server"><HeaderTemplate><table border="1" width="100%"><tr><th>user</th><th>pass</th></tr></HeaderTemplate><ItemTemplate><tr><td><%#Container.DataItem("user")%></td><td><%#Container.DataItem("pass")%></td></tr></ItemTemplate><FooterTemplate></table></FooterTemplate></asp:Repeater></form></body></html>why ??

Link to comment
Share on other sites

Look at the source for the HTML page, do you see the <html> tags?I think it's a naming issue. You have a Container.DataItem, and you have id="customers" on the repeater, but the database reader is called dbread. You might need to rename that to either Container or customers. I'm not sure how the repeater control works, I don't have a lot of experience with .NET.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...