468,110 Members | 1,872 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,110 developers. It's quick & easy.

DataSet copy

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!

Nov 1 '07 #1
4 2080
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

"Soulless" wrote:
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!

Nov 1 '07 #2
On Nov 1, 3:22 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.NoSpamMaam.comwrote:
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

"Soulless" wrote:
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!- Hide quoted text -

- 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?
Nov 1 '07 #3
On Nov 1, 3:22 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.NoSpamMaam.comwrote:
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

"Soulless" wrote:
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!- Hide quoted text -

- 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.

Nov 1 '07 #4

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
On 1 Nov 2007 15:48:25 -0700, Soulless <dg*******@gmail.comwrote:
>On Nov 1, 3:22 pm, Peter Bromberg [C# MVP]
<pbromb...@yahoo.NoSpamMaam.comwrote:
>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

"Soulless" wrote:
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!- Hide quoted text -

- 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.
Nov 3 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Mike | last post: by
10 posts views Thread by localhost | last post: by
1 post views Thread by Jeroen Pot | last post: by
3 posts views Thread by Dmitry Karneev | last post: by
3 posts views Thread by JJ | last post: by
6 posts views Thread by Vik | last post: by
2 posts views Thread by David Richards | last post: by
5 posts views Thread by Mark Chambers | last post: by
5 posts views Thread by Franck | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.