ASP.NET

Moderators: None (Apply to moderate this forum)
Number of threads: 1735
Number of posts: 3305

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
asp.net beginner needs a help ! Posted by jzhou819 on 5 Jan 2007 at 2:25 PM
Hi, I created a page to populate data from an Access database. Everything looks fine except the page is blank. What am I missing? See the code below. default.aspx.vb
Imports System.Data.OleDb
Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim strconnection As String
        Dim cn As New OleDbConnection
        strconnection = "provider=microsoft.jet.oledb.4.0;data source=" & Server.MapPath("app_data\forms.mdb")
        cn.ConnectionString = strconnection
        cn.Open()
        Dim cm As New OleDbCommand
        cm.CommandText = "select * from forms"
        cm.CommandType = Data.CommandType.Text
        cm.Connection = cn
        Dim dr As OleDbDataReader
        dr = cm.ExecuteReader
        While dr.Read
            Dim trrow As New HtmlTableRow
            Dim tddata As HtmlTableCell
            tddata = New HtmlTableCell
            tddata.InnerHtml = dr("form_path").ToString
            trrow.Cells.Add(tddata)
            tddata = New HtmlTableCell
            tddata.InnerHtml = dr("form_name").ToString
            trrow.Cells.Add(tddata)
            tddata = New HtmlTableCell
            tddata.InnerHtml = dr("Form_wordpath").ToString
            trrow.Cells.Add(tddata)


        End While
        cn.Close()
    End Sub
End Class

How come when I run the code, it opens a blank page? Do I need any control in the default.aspx page? Thanks for your help in advance!


Report
Re: asp.net beginner needs a help ! Posted by iwilld0it on 8 Jan 2007 at 7:42 AM
Looks like u are not adding the table rows to the table control ...

Anyways, I would bind the data to a control such as the Repeater, DataList, or DataGrid.

: Hi, I created a page to populate data from an Access database. Everything looks fine except the page is blank. What am I missing? See the code below. default.aspx.vb
:
: Imports System.Data.OleDb
: Partial Class _Default
:     Inherits System.Web.UI.Page
: 
:     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
:         Dim strconnection As String
:         Dim cn As New OleDbConnection
:         strconnection = "provider=microsoft.jet.oledb.4.0;data source=" & Server.MapPath("app_data\forms.mdb")
:         cn.ConnectionString = strconnection
:         cn.Open()
:         Dim cm As New OleDbCommand
:         cm.CommandText = "select * from forms"
:         cm.CommandType = Data.CommandType.Text
:         cm.Connection = cn
:         Dim dr As OleDbDataReader
:         dr = cm.ExecuteReader
:         While dr.Read
:             Dim trrow As New HtmlTableRow
:             Dim tddata As HtmlTableCell
:             tddata = New HtmlTableCell
:             tddata.InnerHtml = dr("form_path").ToString
:             trrow.Cells.Add(tddata)
:             tddata = New HtmlTableCell
:             tddata.InnerHtml = dr("form_name").ToString
:             trrow.Cells.Add(tddata)
:             tddata = New HtmlTableCell
:             tddata.InnerHtml = dr("Form_wordpath").ToString
:             trrow.Cells.Add(tddata)
: 
: 
:         End While
:         cn.Close()
:     End Sub
: End Class
: 

: How come when I run the code, it opens a blank page? Do I need any control in the default.aspx page? Thanks for your help in advance!
:
:
:

Report
Re: asp.net beginner needs a help ! Posted by abhisa on 20 Mar 2007 at 10:10 PM
hi

i know this is a very late reply but i thought it may b helpful for you

the only thing missing in your code is HtmlTable(or)if it is added in design mode..the mistake is you are not adding the rows to the table.

ok

have a nice time bye




Report
Re: asp.net beginner needs a help ! Posted by jzhou819 on 21 Mar 2007 at 5:59 AM
Thank you very much!

: hi
:
: i know this is a very late reply but i thought it may b helpful for you
:
: the only thing missing in your code is HtmlTable(or)if it is added in design mode..the mistake is you are not adding the rows to the table.
:
: ok
:
: have a nice time bye
:
:
:
:
:




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.