Matar Posted September 17, 2006 Share Posted September 17, 2006 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 More sharing options...
justsomeguy Posted September 18, 2006 Share Posted September 18, 2006 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 More sharing options...
aspnetguy Posted September 18, 2006 Share Posted September 18, 2006 a couple things. You populate the datareader but never bind it to anything.you are missing the .Net declartion line (or whatever it is called)(.Net shebang )Add this as the first line.<%@ Page Language="VB" %> Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now