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 'GetDocumenthat code looks like the FreeTextBox code at
http://www.freetextbox.com/forums/S...aspx?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-2DBA408A192E@.microsoft.com...
> 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
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" <nomailreplies@.nowhere.com> wrote in message
news:udLVWM7AFHA.3416@.TK2MSFTNGP09.phx.gbl...
> hat code looks like the FreeTextBox code at
> http://www.freetextbox.com/forums/S...aspx?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-2DBA408A192E@.microsoft.com...
>
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-2DBA408A192E@.microsoft.com...
> 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
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment