No data exists for the row/column error.

Results 1 to 2 of 2

Thread: No data exists for the row/column error.

  1. #1
    Join Date
    Dec 1969

    Default No data exists for the row/column error.

    I&#039;m try to convert a page from classic asp to .Net and I having problems with my recordset. I use the following code to attempt to create a recordset called "ds":<BR><BR>Sub Page_Load(Src As Object, E As EventArgs)<BR> Dim siteID = Request.QueryString("siteID")<BR> Dim strSQL as string ="SELECT sites.logoFile, sites.siteID, sites.clientFolder, images.imageID, images.imageName FROM sites, images WHERE images.imageFile = sites.logoFile AND sites.siteID = " & siteID<BR> response.write(strSQL)<BR> Dim strConn As OleDbConnection = New OleDbConnection("Provider=SQLOLEDB.1;Initial Catalog=XXXXXXXX;Data Source=XXXXXXXXXXXX;User ID=XXXXXXXXXX;Password=XXXXXXXXX")<BR> strConn.Open()<BR> Dim objCmd as New OleDbCommand(strSQL, strConn)<BR> Dim ds as OleDbDataReader<BR> ds = objCmd.ExecuteReader<BR> imageID.Value = ds("imageID")<BR>End Sub<BR><BR>When I do this I get a "No data exists for the row/column" error on the imageID.Value line.

  2. #2
    Join Date
    Dec 1969

    Default RE: No data exists for the row/column error.

    objCmd.ExecuteReader does not return a Recordset; it returns an OleDbDataReader. Off the top of my head.... try:<BR><BR>If ds.Read() Then<BR> imageID.Value = ds.GetString(3) &#039; I don&#039;t think you can use field names, use the ordinal to access the column instead<BR> &#039;or ds.GetInt32(3).toString()<BR>End If<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts