Cant see any data on front end

  • Thread starter Thread starter Intikhab Bashir
  • Start date Start date
I

Intikhab Bashir

Hi,

I have the code below and for some reason when I run it, nothing shows
in the front end.

I put in a label and that does not show a value either.

Both pages are below; viewAccess.aspx (html) and viewAccess.aspx.vb
(code).

Please help, thanks in advance.

----------------------------------------------------------------------------

in viewAccess.aspx.vb:

Imports System.Data
Imports System.Data.OleDb

Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents myDataReader As
System.Web.UI.WebControls.DataGrid

Sub Page_Load(ByVal Source As Object, ByVal E As EventArgs)
Dim connString As String
connString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
_
"c:\inetpub\wwwroot\test\db\nap.mdb;"

Dim objConn As OleDbConnection
objConn = New OleDbConnection(connString)
objConn.Open()

Dim strSQL As String
strSQL = "select id, name from personDetail"

Dim dbCommand As OleDbCommand
dbCommand = New OleDbCommand(strSQL, objConn)

Dim objReader As OleDbDataReader
objReader = dbCommand.ExecuteReader(CommandBehavior.CloseConnection)

myDataReader.DataSource() = objReader

objReader.Close()
Label1.Text = "hello"
End Sub

End Class

---------------------------------------------------------------------------


in viewAccess.aspx:

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="viewAccess.aspx.vb" %>

<HTML>
<HEAD>
<title>Untitled</title>
</HEAD>
<body>
<asp:DataGrid ID="myDataReader" Runat="server"></asp:DataGrid>
<asp:Label id="Label1" runat="server"></asp:Label>
</body>
</HTML>
 
Hi

I did not see the form tag in your html source
<%@ Page Language="vb" AutoEventWireup="false
Codebehind="viewAccess.aspx.vb" %><HTML><HEAD><title>Untitled</title></HEAD><body><Form ID="Form1" Runat="Server" Method="Post"><asp:DataGrid ID="myDataReader" Runat="server"></asp:DataGrid><asp:Label id="Label1" runat="server"></asp:Label></Form></body></HTML

Bin Song, MCP
 
Inserted the form tag but still didn't work.

AHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!

Thanks in advance,
Intikhab.

----------------
not a programmer
but trying!!!!!

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
This did not work.

Thanks in advance,
Intikhab.

----------------
not a programmer
but trying!!!!!

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
dear bashir

put the following code:

mydatareader.databin

basically you need to bind the source to the grid

it will wor

note
its a wrong convention to name a datagrid as mydatareader (people will confuse it with DataReader object

hope it helps

----- intikhab bashir wrote: ----

This did not work

Thanks in advance
Intikhab

---------------
not a programme
but trying!!!!

*** Sent via Devdex http://www.devdex.com **
Don't just participate in USENET...get rewarded for it
 
That did not work.

For some reason I have a label set to "hello".

When I run the code the label does not show "hello". Really confused
now. Dont think the page_load does not work!!!!
 
Back
Top