Spire.DataExport for .NET is a 100% pure data .NET library suit for exporting data into MS Word, Excel, RTF, Access, PDF, XPS, HTML, XML, Text, CSV, DBF, SYLK, SQL Script, DIF, Clipboard, etc.

Thu Feb 24, 2011 2:45 am

I want to assign the data source of the DataGridView with the oleDbCommand, but I failed. The code:
dataGridView.DataSource = oleDbCommand;
I want your help. Thank you.

tom
 
Posts: 14
Joined: Tue Nov 30, 2010 7:21 am

Fri Feb 25, 2011 3:53 am

If you want to do so, you should use a data adapter, it like a intermediary of the command and DataGridView. You may use it with the following code: OleDbDataAdapter da = new OleDbDataAdapter(oleDbCommand);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView.DataSource = dt;
e-iceblue support
User avatar

iceblue support
 
Posts: 240
Joined: Tue Dec 21, 2010 2:56 am

Return to Spire.DataExport