473,407 Members | 2,359 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,407 software developers and data experts.

no data exists for the row/column

I run the following code:

objoledbcommand.Connection.Open()
strsql = "select first_name + ' ' + last_name as fullname from
tblperson where pers_entity_id = '" & ddlClient.SelectedValue & "'"
objoledbcommand.CommandText = strsql
objoledbdatareader = objoledbcommand.ExecuteReader
txtClient.Text = objoledbdatareader.Item("first_name")
objoledbcommand.Connection.Close()

and it errors on line "txtClient.Text = objoledbdatareader.item("fullname")
with
no data exists for the row/column.

I ran the exact same query in query analyzer with the correct id in the
where clause and one record is found.

on debug the strsql has all the items it needs in where clause

Any wisdom?
Aug 23 '06 #1
1 5449
After the command returns you a DataReader, you have to read records from
database line by line:

....

objoledbdatareader = objoledbcommand.ExecuteReader

If objoledbdatareader.Read() Then
txtClient.Text = objoledbdatareader.Item("first_name")
End If

....
"bindurajeesh" <bi**********@discussions.microsoft.comwrote in message
news:F5**********************************@microsof t.com...
>I run the following code:

objoledbcommand.Connection.Open()
strsql = "select first_name + ' ' + last_name as fullname from
tblperson where pers_entity_id = '" & ddlClient.SelectedValue & "'"
objoledbcommand.CommandText = strsql
objoledbdatareader = objoledbcommand.ExecuteReader
txtClient.Text = objoledbdatareader.Item("first_name")
objoledbcommand.Connection.Close()

and it errors on line "txtClient.Text =
objoledbdatareader.item("fullname")
with
no data exists for the row/column.

I ran the exact same query in query analyzer with the correct id in the
where clause and one record is found.

on debug the strsql has all the items it needs in where clause

Any wisdom?

Aug 23 '06 #2

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

Similar topics

3
by: anuu | last post by:
Hi, I would like to prepare a data dictionary for my database (northwind). I have framed the below SQL SELECT 'NAME ' = a.name, 'DESCRIPTION' = b.value, 'Type ' = type_name(a.xusertype),
4
by: Bill Stock | last post by:
The few times in the past that I've loaded unbound data, I've tended to cheat and use temp tables (not really unbound) or use code for small datasets. I'm currently involved in a project that...
11
by: Bonjour | last post by:
Hi everybody ! I' d like to check data before inserting. Select @nb = Count (idCustomer) From Customer Where company like '%' + @company+ '%' If "PEUGEOT SA" already exists, @nb > 0 if I...
2
by: MattB | last post by:
I know I can use dataviews and more looping to do this, but I'm wondering if there's a more elegant or more concise way to do this. I've got two DataTables with a column called guest_no. I'd love...
3
by: Bob Day | last post by:
VS 2003, sql How do you determine the data type of a column if its value is DBNull? 1)Table: Column1 STRING non-nullable 2) Fill to a DataSet via DataAdapter 3) dim Data_Type_Is...
2
by: Chris | last post by:
Hi, I want to show the whole recordset. There are 42 records and 2 fields. .... comd = New System.Data.OleDb.OleDbCommand("select name,lok from pc", oConnection) dtreader = comd.ExecuteReader...
10
by: pbd22 | last post by:
Hi. Like the title says - how do i do this? I was given the following example: INSERT INTO TABLE2 SELECT * FROM TABLE1 WHERE COL1 = 'A' The above statement threw the following error:
1
by: pmouseca | last post by:
Hello all, I have two tables, one call Assignments, the other call Grades. In Assignment, the columns are: Asn_ID, Asn_Name, Asn_MaxGrade In Grades, the columns are: Grade_ID,...
2
by: Dennis | last post by:
I need another pair of eyes to look at this code. I am getting rows from an OleDbDataReader from an Access 2002-2003 database. ... If Not _reader Is Nothing Then If _reader.HasRows Then Dim...
0
by: bharathreddy | last post by:
This article will explain you how to check weather a column already exists in a table before you add the column to the table using alter command. Using the system tables...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.