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

Extracting data from a DataSet

Hello,

I am using the following code to pull data from my dataset in Page_Load

Dim str As String
Dim ds As System.Data.DataSet
Dim dt As System.Data.DataTable
Dim dr As System.Data.DataRow
Dim dc As System.Data.DataColumn

ds = UserTypeQueryMethod()

For Each dt In ds.Tables
For Each dr In dt.Rows
For Each dc In dt.Columns
if dr(dc) = "owner" then
if dc.DefaultValue = "bob" then
msgbox("good")
exit sub
end if
end if
Next dc
Next dr
Next dt

The code gets in to the "owner" field with no problem but I get an exception
that states:

System.InvalidCastException: Operator is not valid for type 'DBNull' and
string "bob"

How do I use the dc.DataType property to check that I have a string ??

thanks for any replies

Mar 21 '06 #1
0 977

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

Similar topics

2
by: Steve | last post by:
Hi, I have a very long string, someting like: DISPLAY=localhost:0.0,FORT_BUFFERED=true, F_ERROPT1=271\,271\,2\,1\,2\,2\,2\,2,G03BASIS=/opt/g03b05/g03/basis,...
13
by: PS | last post by:
I want to display the image from database to picture box through ado.net and vb.net I have some images present in a sql server 2000 table stored under 'image' datatype. I want to extract and...
0
by: Oldhandandy | last post by:
I've created a dataset from a stored procedure. I want to extract data from certain fields within the dataset without having to create a datagrid.
5
by: Michael Hill | last post by:
Hi, folks. I am writing a Javascript program that accepts (x, y) data pairs from a text box and then analyzes that data in various ways. This is my first time using text area boxes; in the past,...
3
by: Gary | last post by:
Guys, I need to create pie charts,bar diagrams and percentages based on an excel spreadsheet.I guess this is one of that vb automation job, but I havent done VBA before Is crystal reports the...
3
by: Elena | last post by:
I need to extract data from a recordset. I have to find the identifier of the table and add 1 to it. In VB6, I used a recordset, as in the code below: 'get a new item number strsql = "Select...
4
by: Byron Hopp | last post by:
We have the need to extract data from an ADO dataset to an Access MDB. We have this working be having an empty MDB that we copy and utilize for the extract. We get errors on an irregular basis. ...
6
by: Werner | last post by:
Hi, I try to read (and extract) some "self extracting" zipefiles on a Windows system. The standard module zipefile seems not to be able to handle this. False Is there a wrapper or has...
4
by: apatel85 | last post by:
Hey Guys, Total Number of Records (Based on 5 fields): 1000 Total Unique Records (Based on 5 Fields): 990 Total number of fields: 5 I have question regarding extracting duplicates from the...
10
by: Mikesinfo | last post by:
Hi everyone, Hopefully this is the right forum to use. I am programming in C# and I've been racking my brain and searching for the right answer to extract my information according to after a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.