PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Retrieving data directly from a table adapter

Reply

Retrieving data directly from a table adapter

 
Thread Tools Rate Thread
Old 14-09-2006, 04:50 PM   #1
=?Utf-8?B?U3RldmUgSmVuc2Vu?=
Guest
 
Posts: n/a
Default Retrieving data directly from a table adapter


In working with ADO.NET in VS2005, I need to find specific rows in the filled
adapter and get values from specific columns in those rows. To do this, I
first have to query the table adapter's binding source:

bs1.find("datafield",value to find in the datafield)

then I need an integer to store the position of the returned row:

intPos = bs1.position

Then I can retrieve data from the table adapter:

?me.ta1.GetData.Item(intpos).Item(2).ToString

The only way to get the information is using the ToString property, so I
have to convert any returned value that is not a string back to its actual
data type (number, date, etc.)

In addition, the find only works with one column value, so I can't find a
row or rows in the datatable based on multiple columns.

Last, if the find returns multiple rows, I only get the position of the
first one.

There must be a better way...

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off