HighTechTalks DotNet Forums  

Accessing DataTable Problem

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss Accessing DataTable Problem in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
=?Utf-8?B?R3JheWJhbmU=?=
 
Posts: n/a

Default Accessing DataTable Problem - 08-23-2007 , 09:26 AM






Hi Folks,
I am having a problem reading an existing typed datatable. I am sure that I
have over looked something simple but I am not seeing the forest for the
trees. I am using the below code and the reader does not pickup any rows.

Private MyDataSet As SomeDataSet
Private MyDataTable As SomeDataSet.SomeDataTable

'The WhereClause is just date range SomeColumnDateValue >= #9/9/1999# AND
SomeColumnDateValue <= #9/10/1999#
Private Function MyGetData(ByVal MyWhereClaus As String) As ArrayList

'Configure and execute datareader
Dim MyDataTable As New DataTable

MyDataSet = New SomeDataSet
MyDataTable = New SomeDataSet.SomeDataTable

Dim MyArrayList As New ArrayList
'Dim MyDataTable As New DataTable

'I have tried both the table linkages
MyDataTable = New SomeDataSet.SomeDataTable
'or
MyDataTable = MyDataSet.Tables("DataTableName")

Dim MyExpression As String = MyWhereClaus
Dim MySortOrder As String = Me.OptionSelection & " DESC"
'The OptionSelection is SomeColumnName

MyDataTable.Select(MyExpression, MySortOrder)
Dim MyDataTableReader As New DataTableReader(MyDataTable)

I get a null result (0 rows) with the correct schema, it does not matter
wether
I use the filter assignment or not.

Any help is appreciated

Reply With Quote
  #2  
Old   
William Vaughn
 
Posts: n/a

Default Re: Accessing DataTable Problem - 08-23-2007 , 12:45 PM






Sorry, I don't see where the New DataSet or DataTable are populated with
rows. A ST DataTable is simply a structure to map the rowset data.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"Graybane" <Graybane (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi Folks,
I am having a problem reading an existing typed datatable. I am sure that
I
have over looked something simple but I am not seeing the forest for the
trees. I am using the below code and the reader does not pickup any rows.

Private MyDataSet As SomeDataSet
Private MyDataTable As SomeDataSet.SomeDataTable

'The WhereClause is just date range SomeColumnDateValue >= #9/9/1999# AND
SomeColumnDateValue <= #9/10/1999#
Private Function MyGetData(ByVal MyWhereClaus As String) As ArrayList

'Configure and execute datareader
Dim MyDataTable As New DataTable

MyDataSet = New SomeDataSet
MyDataTable = New SomeDataSet.SomeDataTable

Dim MyArrayList As New ArrayList
'Dim MyDataTable As New DataTable

'I have tried both the table linkages
MyDataTable = New SomeDataSet.SomeDataTable
'or
MyDataTable = MyDataSet.Tables("DataTableName")

Dim MyExpression As String = MyWhereClaus
Dim MySortOrder As String = Me.OptionSelection & " DESC"
'The OptionSelection is SomeColumnName

MyDataTable.Select(MyExpression, MySortOrder)
Dim MyDataTableReader As New DataTableReader(MyDataTable)

I get a null result (0 rows) with the correct schema, it does not matter
wether
I use the filter assignment or not.

Any help is appreciated


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.