Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Reassign value to private

Reply
Thread Tools

Reassign value to private

 
 
=?Utf-8?B?VGltOjouLg==?=
Guest
Posts: n/a
 
      01-27-2005
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
 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      01-27-2005
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

"Tim::.." <myatix_at_hotmail.com> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
 
=?Utf-8?B?VGltOjouLg==?=
Guest
Posts: n/a
 
      01-27-2005
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


"Eliyahu Goldin" wrote:

> 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
>
> "Tim::.." <myatix_at_hotmail.com> wrote in message
> news:(E-Mail Removed)...
> > 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

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reassign two objects to one pointer? Immortal Nephi C++ 1 05-20-2009 01:06 PM
reassign to builtin possible !? Bernhard Merkle Python 8 01-04-2008 08:18 AM
How do I reassign USB ports Oldman@screwedup.com Computer Support 2 06-10-2006 10:28 PM
how to reassign variable biswaranjan.rath XML 3 05-05-2006 01:07 PM
reassign keys in an STL map Shailesh Humbad C++ 7 11-02-2004 12:05 AM



Advertisments