![]() |
|
|
|||||||
![]() |
ASP Net - There is no row at position 0??? |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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==?= |
|
|
|
|
#2 |
|
Posts: n/a
|
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 |
|
|
|
#3 |
|
Posts: n/a
|
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 |
|
|
|
#4 |
|
Posts: n/a
|
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 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
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 |