DataSource for Repeater to convert from System.Data.DataSet

G

Greg Cyrus

Hi,
i have created a function to open a Databse by OLEDB and fill it into a
System.Data.DataSet-Objekt by oleDBAdapter.Fill-Mehtod..

Now I want to assign this DataSet to a normal Repeater-Control. This
Repeater-Control accepts anything like System.Collections.IEnumerable for a
DataSource.

I have tried to copy the System.Data.Dataset into a DataView-Objekt
(System.Collections.IEnumerable) but I guess there must be some other and
smarter solution to convert the OleDB-Adapter.Foll-Result to fill the the
Repeater-Control will an accepted DataSource.

When I use the OLEDB-Connectin the connectionsting like
"PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=c:/..." for the
SQL-Connection to open - errors orrcur..

So how can I chance a "objOleDBAdapter.SelectCommand = New
OleDb.OleDbCommand("Select * from tab_X")" like a Repeater-Contol can user
it?
 
K

Karl Seguin

Greg:
As I understand it, you have a System.Data.DataSet and you want to bind it
to a Repeater's DataSource property...if so, you might be hitting yourself
:)

simply do

myRepeater.DataSource = myDataSet;
myRepeater.DataBind();

(remove the ; if in VB.Net).

Behind the scenes, the DataSource is actually a DataView...it basically
does:
myRepeater.DataSource = myDataSet.Tables[0].DefaultView;

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top