473,395 Members | 1,464 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,395 software developers and data experts.

Check for the existance of a specific table in a dataset.

UJ
I'm getting a dataset back from a web service and I want to verify that the
table I want exists before trying to access it (which will cause an
exception.) Is there an easy way to check for a specific table in my dataset
without doing a try/catch or is that the easiest way?

TIA - Jeff.
Jan 25 '06 #1
2 7451
Hi,

"UJ" <fr**@nowhere.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
I'm getting a dataset back from a web service and I want to verify that
the table I want exists before trying to access it (which will cause an
exception.) Is there an easy way to check for a specific table in my
dataset without doing a try/catch or is that the easiest way?


if ( dataSet.Tables["MyTable"] == null )
throw new exception("Table no present");

in other words, just check for null when you refer to the table, the same
apply to columns

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jan 25 '06 #2
You can do what Ignacio says or there is also a "Contains" attribute
from the table and column collections to verify the existence of a
member before accessing it.

_Randal

Jan 25 '06 #3

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

Similar topics

2
by: Got2Go | last post by:
Hello, I am trying to come up with a function that will search the source of the page for a specific string. If that string is found, then have it modify specific tags inside of a table and...
1
by: David | last post by:
Hello, I use the VS .NET 2003. Say I have a Windows form (with C# code, of course) which is connected to a database to one table. I can browse through the records, but I don't know how to...
1
by: Shapper | last post by:
Hello, I have am connecting a datagrid to a dataset: dgProducts.DataSource = dsProducts() dsProducts is a function which returns a dataset. How can I detect if the dataset which is being...
1
by: sianan | last post by:
I tried to use the following example, to add a checkbox column to a DataGrid in an ASP.NET application: http://www.codeproject.com/aspnet/datagridcheckbox.asp For some reason, I simply CAN'T get...
1
by: Brian | last post by:
Hello - Im new to ADO.NET so bear with me here. I have an Access DB, simplified as follows: TABLE Person person_ID autonumber PK last_name text first_name text
3
by: Anthony Bowman | last post by:
Hello, I have a access application that resides locally on users desk, I am writing a VB.Net interface that let's the users pull data down from a SQL server database and populate the local access...
1
by: jaya_rath | last post by:
Check table's existance -------------------------------------------------------------------------------- How can I check if a table exists in an MS SQL database using asp.plz help me . advance...
14
by: Dan | last post by:
Hello, we have an intranet application using Windows Integrated Authentification. When an user starts the application, he gets a form for inputting data. The first time he does that, the...
1
by: Cirene | last post by:
Using VB.NET (latest version) I want to log onto an FTP server and check for the existance of 10 files in 3 different directories. I would prefer to do this over 1 live connection. Anyone have...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.