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...
pulpfiction Posted September 18, 2006 Share Posted September 18, 2006 Try changing the sql = "SELECT * FROM stu"to sql = "SELECT user,pass FROM stu" Link to comment Share on other sites More sharing options...
jesh Posted September 18, 2006 Share Posted September 18, 2006 It doesn't look like you are binding the data to the control.I don't know about VB, but in C# you'd want to add something along the lines of: DataTable table = new DataTable();table.Load(dbread); // dbread is your SqlDataReader Once you have the datasource, you'd need to bind it to the Repeater: customers.DataSource = table;customers.DataBind(); Good luck. Link to comment Share on other sites More sharing options...
Matar Posted September 20, 2006 Author Share Posted September 20, 2006 hi thank you all issues is resloves 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