Reassign value to private

G

Guest

Hi Can some one please tell me how I re assign a value to a private variable
with a querystring!

I want to do something like this!

Private rowID As Integer = request.querystring(id)

However this doesn't work!

Would really appritiate anyhelp!

Thanks

... Current Code ..
Private rowID As Integer = "1"

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Get Text for Editor
If Not Page.IsPostBack Then
FreeTextBox1.Text = GetDocument()
End If


End Sub 'Page_Load

Public Sub Button_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
UpdateDocument(FreeTextBox1.Text)
End Sub 'Button_Click

Private Function GetDocument() As String
Dim ds As DataSet = GetDataSet(("SELECT * FROM tblPageContent WHERE
pageID=" + rowID.ToString()))
Dim table As DataTable = ds.Tables(0)
Dim row As DataRow = table.Rows(0)
Dim doc As String = row("content").ToString()
Return doc
End Function 'GetDocument
 
E

Eliyahu Goldin

Querystring is a string. rowID is integer. You need to convert a string to
an integer. Example:

rowID = System.Convert.ToInt32 (request.querystring(id))

Eliyahu
 
G

Guest

Why do I then get

Error:
There is no row at position 0.

I presume it is because GetDocument() is being executed before rowID has a
value!
How can I change this???

Thanks
 

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

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top