473,385 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Reassign value to private

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
Nov 19 '05 #1
2 934
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:9C**********************************@microsof t.com...
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

Nov 19 '05 #2
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:9C**********************************@microsof t.com...
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


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Shailesh Humbad | last post by:
I have a class and map like this: class MyObject { ... }; map<int, MyObject> Box; Now, I want to reassign the keys of one or more of the pairs in Box based on another map<int, int> that...
5
by: Nathan Sokalski | last post by:
I have a user control that contains three variables which are accessed through public properties. They are declared immediately below the "Web Form Designer Generated Code" section. Every time an...
3
by: biswaranjan.rath | last post by:
Can i do something like this: <xsl:variable name="varMaxDiffId"> <xsl:choose> <xsl:when test="$varMaxDiffId == 'NULL'"> <xsl:value-of select="-1"/> </xsl:when> <xsl:when test="$varMaxDiffId <...
3
by: Schwammkopf | last post by:
Hi ! What i want to do in C++ is : int a = new a; a = 0, a = 0; int* p = &a; while (1) // any condition instead of 1
9
by: Johnny Jörgensen | last post by:
Hi y'all I've got a custom control that is inherited from a normal TextBox. To that, I've added a new property that I call "Units", Which is a collection class containing members of a "Unit"...
1
by: cfli1688 | last post by:
I have the following list: <id>1</id> <title>a1</title> <id>1</id> <title>a2</title> <id>2</id> <title>b1</title> <id>2</id> <title>b2</title>
8
by: Bernhard Merkle | last post by:
Hi there, I am reading Learning Python 3e from Mark Lutz and just found out that reassigning to builtins is possible. What is the reason, why Python allows this ? IMO this is very risky and can...
5
by: xirowei | last post by:
public class Result { private int countA = 0; private int countB = 0; private int statement; private boolean statusA = false; private boolean statusB = false; private int arrayA = new...
6
by: ahilar12 | last post by:
hi all can anybody tell me the logic or the code how to reassign some records from one user to another user
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.