Friday, March 16, 2012

Member Error

I have an error that i need an explantion for:

.RecordNumber is not a member of webapplication

I am learning asp.net, so i am stumped.

its a vb.net, ASP web application.

Thanks for any help!

JBheres the complete code:

Dim strSQL As String
If Me.IsPostBack Then
ptyDataSet = Me.Session.Item("DataSet")
ptySQLDataAdapter = Me.Session.Item("DataAdapter")
ptySQLDataConnection = Me.Session.Item("DataConnection")
Else
Me.RecordNumber = 1 <-- error here
Try
'Creating the connection object and opening the connection
ptySQLDataConnection = New SqlClient.SqlConnection("Initial Catalog=pubs;Data
Source=JPGCS;User ID=temp;Password=temp;")
ptySQLDataConnection.Open()
strSQL = "SELECT * FROM authors"
'Creating the Data Adapter that will fill the DataSet
ptySQLDataAdapter = New SqlClient.SqlDataAdapter(strSQL, ptySQLDataConnection)
ptyDataSet = New DataSet
'Filling the DataSet
ptySQLDataAdapter.Fill(ptyDataSet)
'Setting the DataGrids DataSource Property
grdAuthors.DataSource = ptyDataSet
grdAuthors.DataBind()
grdAuthors.SelectedIndex = Me.RecordNumber - 1 'The index property is 0 based so
record number 1 is index 0 <-- error here
Me.MoveToRecord(Me.RecordNumber)
Me.Session.Item("DataSet") = ptyDataSet
Me.Session.Item("DataAdapter") = ptySQLDataAdapter
Me.Session.Item("DataConnection") = ptySQLDataConnection
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End If
End Sub

thanks again,

JB

0 comments:

Post a Comment