How to use GridView by adding code in "aspx.vb" file?

Joined
Oct 28, 2008
Messages
2
Reaction score
0
Hi, I am VB developer and new to asp.net. I am trying to use GridView control by writing code in "aspx.vb" file in asp.net 3.5 but not able to display data on page. I am wondering if this is possible?

I am using following code:

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

Dim OracleConn As New OracleConnection
Dim Sql As String
Dim dr As OracleDataReader
Dim ds As DataSet
Dim da As New OracleDataAdapter
Dim dbComm As New OracleCommand

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If (Page.IsPostBack) Then
OracleConn.ConnectionString = "user id=lots;data source=orcl_uat;password=asap"
OracleConn.Open()
FillGrid()
End If
End Sub


Public Sub FillGrid()

Sql = "SELECT * FROM ASP"

dbComm.CommandText = Sql
dbComm.Connection = OracleConn
da = New OracleDataAdapter(dbComm)
ds = New DataSet
da.Fill(ds, "tblAPS")

GridView.DataSource = ds
GridView.DataBind()

End Sub

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

I am not getting any error message and page doesn't display data on page. I know how to use GridView by adding code in "aspx" file but i want to use it by writing code in "aspx.vb" file. Is this possilbe?

Best Regards,
Umar Rehman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top