Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - There is no row at position 0???

 
Thread Tools Search this Thread
Old 01-26-2005, 02:11 PM   #1
Default There is no row at position 0???


Can someone please tell me why I keep getting the error!

There is no row at position 0
Dim row As DataRow = table.Rows(0)

I know it has something to do with the value of rowID because if I set rowID
as a fixed value rather than using a querystring it works!

Any ideas???

Thanks

Private rowID As Integer

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
rowID = Request.QueryString(ID)
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


=?Utf-8?B?VGltOjouLg==?=
  Reply With Quote
Old 01-26-2005, 02:27 PM   #2
Juan T. Llibre
 
Posts: n/a
Default Re: There is no row at position 0???
hat code looks like the FreeTextBox code at
http://www.freetextbox.com/forums/Sh...spx?PostID=613

You might want to compare your version of that code
with the published version at that page, which works,
and see where you made a transcription or conceptual
mistake.

Offhand, I see that DonnyEMU declared

Private rowID As Integer = 1

so that there wouldn't be a reference
to an empty row in the initial call.




Juan T. Llibre
ASP.NET MVP
===========
"Tim::.." <myatix_at_hotmail.com> wrote in message
news:67A134C0-4AE9-408E-A871-...
> Can someone please tell me why I keep getting the error!
>
> There is no row at position 0
> Dim row As DataRow = table.Rows(0)
>
> I know it has something to do with the value of rowID because if I set
> rowID
> as a fixed value rather than using a querystring it works!
>
> Any ideas???
>
> Thanks
>
> Private rowID As Integer
>
> 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
> rowID = Request.QueryString(ID)
> 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





Juan T. Llibre
  Reply With Quote
Old 01-26-2005, 02:29 PM   #3
Juan T. Llibre
 
Posts: n/a
Default Re: There is no row at position 0???
re:
> so that there wouldn't be a reference
> to an empty row in the initial call.


Oops...that should be :

> so that there wouldn't be a reference
> to a non-existent row in the initial call.





Juan T. Llibre
ASP.NET MVP
===========
"Juan T. Llibre" <> wrote in message
news:...
> hat code looks like the FreeTextBox code at
> http://www.freetextbox.com/forums/Sh...spx?PostID=613
>
> You might want to compare your version of that code
> with the published version at that page, which works,
> and see where you made a transcription or conceptual
> mistake.
>
> Offhand, I see that DonnyEMU declared
>
> Private rowID As Integer = 1
>
> so that there wouldn't be a reference
> to an empty row in the initial call.
>
>
>
>
> Juan T. Llibre
> ASP.NET MVP
> ===========
> "Tim::.." <myatix_at_hotmail.com> wrote in message
> news:67A134C0-4AE9-408E-A871-...
>> Can someone please tell me why I keep getting the error!
>>
>> There is no row at position 0
>> Dim row As DataRow = table.Rows(0)
>>
>> I know it has something to do with the value of rowID because if I set
>> rowID
>> as a fixed value rather than using a querystring it works!
>>
>> Any ideas???
>>
>> Thanks
>>
>> Private rowID As Integer
>>
>> 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
>> rowID = Request.QueryString(ID)
>> 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

>
>





Juan T. Llibre
  Reply With Quote
Old 01-26-2005, 04:09 PM   #4
Marina
 
Posts: n/a
Default Re: There is no row at position 0???
You are calling GetDocument before you assign rowID. So rowID is always 0
when this function gets called, and your query does not return a result.

"Tim::.." <myatix_at_hotmail.com> wrote in message
news:67A134C0-4AE9-408E-A871-...
> Can someone please tell me why I keep getting the error!
>
> There is no row at position 0
> Dim row As DataRow = table.Rows(0)
>
> I know it has something to do with the value of rowID because if I set
> rowID
> as a fixed value rather than using a querystring it works!
>
> Any ideas???
>
> Thanks
>
> Private rowID As Integer
>
> 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
> rowID = Request.QueryString(ID)
> 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





Marina
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
ICM Engineering Position amangrello The Lounge 0 03-23-2007 05:28 PM
Panasonic S35 memory position Alan Faux DVD Video 3 09-14-2004 02:52 PM
New Panasonic DVD Player: Memory Flagging Of A Position For Future Recall - How ? Robert11 DVD Video 0 06-23-2004 07:19 PM
dvd position memory feature - yamaha dvx-s120 SS DVD Video 6 02-18-2004 04:36 AM
Re: System Developer position wanted Eric R. DVD Video 0 06-24-2003 07:04 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46