DataSet copy

S

Soulless

Hi, is there any way to copy a dataset to a datagrid? I have a
dataset and want to copy to a datagridview, but I get no results....
thx!
 
S

Soulless

Soulless,
you cannot "copy" a DataSet to a DataGrid. DataGrid only knows how to do
DataBinding against the DataSource.
So, you set DataSource property of the DataGrid to DataSet, or to one of the
DataTables in the DataSet.
-- Peter
// Abandon all hope, ye who enter here.http://www.eggheadcafe.com
unBlog:http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com





- Show quoted text -

I created a dataset and set my datasource of the grid to it.

I am getting the following error now:

Error 12 Cannot implicitly convert type 'System.Data.DataTable' to
'OpTx.Extract.DataSet.Impac.dsUpdateSQL' C:\develop\extract\Forms\Impac
\FormScheduleNotes.cs 720 28 Forms

The line of code is:

dsUpdateSQL1 = ibrScheduleNotes.dsSched.Tables["Schedule"].Copy();

dsUpdateSQL1 is my dataset.

Any ideas?
 
S

Soulless

Soulless,
you cannot "copy" a DataSet to a DataGrid. DataGrid only knows how to do
DataBinding against the DataSource.
So, you set DataSource property of the DataGrid to DataSet, or to one of the
DataTables in the DataSet.
-- Peter
// Abandon all hope, ye who enter here.http://www.eggheadcafe.com
unBlog:http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com





- Show quoted text -

Hi,

I have created a dataset and have set my datasource on the grid to the
dataset.

I get the following error:

Error 12 Cannot implicitly convert type 'System.Data.DataTable' to
'OpTx.Extract.DataSet.Impac.dsUpdateSQL' C:\develop\extract\Forms\Impac
\FormScheduleNotes.cs 720 28 Forms

The syntax is:

dsUpdateSQL1 = ibrScheduleNotes.dsSched.Tables["Schedule"].Copy();

dsUpdateSQL1 is my dataset and the ibrScheduleNotes.dsSched is a
dataset from another class.
 
B

bob clegg

Hi,
Wouldn't the copy have to be table to table?
The ouput of copy is a datatable not a dataset.
dsUpdateSQL1.Tables["mySchedule"] =
ibrScheduleNotes.dsSched.Tables["Schedule"].Copy();
I haven't tried this just seems logical.
hth
Bob


Soulless,
you cannot "copy" a DataSet to a DataGrid. DataGrid only knows how to do
DataBinding against the DataSource.
So, you set DataSource property of the DataGrid to DataSet, or to one of the
DataTables in the DataSet.
-- Peter
// Abandon all hope, ye who enter here.http://www.eggheadcafe.com
unBlog:http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com





- Show quoted text -

Hi,

I have created a dataset and have set my datasource on the grid to the
dataset.

I get the following error:

Error 12 Cannot implicitly convert type 'System.Data.DataTable' to
'OpTx.Extract.DataSet.Impac.dsUpdateSQL' C:\develop\extract\Forms\Impac
\FormScheduleNotes.cs 720 28 Forms

The syntax is:

dsUpdateSQL1 = ibrScheduleNotes.dsSched.Tables["Schedule"].Copy();

dsUpdateSQL1 is my dataset and the ibrScheduleNotes.dsSched is a
dataset from another class.
 

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

Top