Kindly tell me how can I insert data from a bi-dimensional array ex. array1(10,10) to a DataGrid/DBGrid and visa-versa.
Please explain with a sample source code.

Recommended Answers

All 9 Replies

Do you know how to populate data from/to a DB into/from a DataGrid/DBGrid ?

Database table is a 2D array only.

Yes Sir, I know how to populate data from DB to DataGrid/DBGrid but I'm trying to create a bi-dimensional array which will pass data to the grids but Im unsuccessfull so far.
Hence pls help.

Using FlexGrid's TextMatrix property I could insert data into each cell but how can the similar be done in DataGrid/DBGrid ?

But I think using DataGrid/DBGrid requires DataSource, RecordSet, or DataMember and complete the connection. Is that the case?

Hi,

As the name Indicates, DataGrid and DBGrid need to be bound to a database Recordset object. You cannot bind a LocalArray to db grid.. If at all you want to bind the array, Save the Array in some temp table in database and open the recordset and Bind..

If you can do using MSFlexGrid, then why are you so much wanting to bind it to DataGrid/DBGrid....?

Regards
Veena

Ya know Queen, not that I have ever tried it, but would not a disconnected ado recordset be sufficient as a data source?


Just a thought from left field, if not from beyond... :)

Good Luck

Hi vb5prgmr,

Actually Disconnected Datasets are once, wherein you actually connect recordset to the database table (as usual normal procedure),
and then disconnect the active connection of the recordset by setting it to nothing.. Again a database table required...

binding array/system table/datatable to datagrid can be easily done in VB.net, but not sure of vb6...

I still feel, FlexGrid is most appropriate control in such situations...

Regards
Veena

As far as I think FlexGrid is most appropriate control in such situations as said by QVeen

Hi vb5prgmr,

Actually Disconnected Datasets are once, wherein you actually connect recordset to the database table (as usual normal procedure),
and then disconnect the active connection of the recordset by setting it to nothing.. Again a database table required...

binding array/system table/datatable to datagrid can be easily done in VB.net, but not sure of vb6...

I still feel, FlexGrid is most appropriate control in such situations...

Regards
Veena

I have some thoughts,...
1) Recordsets are multi-dimensional Array/similar to multi-dimensional array containing collection of records
2) If Yes, then why cant arrays b bound to DBGrid/DataGrid, the way we usually do with Recordsets?
3) Also, can we insert/append a multi-dimensional array to any RecordSet?

If Im wrong pls correct me and/or share your thoughts.

Thank you.

Do you know how to populate data from/to a DB into/from a DataGrid/DBGrid ?

Database table is a 2D array only.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.