|
#1
|
|||
|
|||
|
Hello!
I have to maintain in an old code here, and I have to migrate the database "Access" to "MSSQL". So far so good ... The consultations, inclusions and exclusions are all done. The problem is that there is a "DBGrid" here, that takes a "data" object as "DataSource". This object in turn, opened a database "access", carrying a table and populate the "DbGrid. I would like this populate this "DBGrid" using a "Recordset". Itīs possible? ![]() For thus, I would do the query and populate a "grid" with the result. Thanks. |
|
#2
|
||||
|
||||
|
I wouldn't use a grid as a replacement, I'd use a ListView which is easily populated using a recordset.
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section. ![]() Please use [Code]your code goes in here[/Code] tags when posting code. Before posting your question, did you look here? Got a question on Linux? Visit our Linux sister site. Modifications Required For VB6 Apps To Work On Vista ![]() Microsoft MVP 2005/2006/2007/2008/2009 |
|
#3
|
||||
|
||||
|
DBGrid is obsolete.
Use DataGrid, instead. Using ADO become simple to populate DataGrid with a ADO recordset (without a DAO Data control or ADO Data control). Create your ADO Recordset then assign them to DataGrid: Code:
Dim cn as ADODB.Connection Dim rs as ADODB.Recordset Set cn = new ADODB.Connection Set rs = new ADODB.Recordset cn.ConnectionString = <your_string_database_connection> cn.CursorLocation = adUseClient cn.open rs.Open "SELECT * FROM table_name", cn, adForwardOnly, adReadOnly, adCmdText Set DataGrid1.DataSource = rs
__________________
HTH ![]() VBCorner code: MenuCreator add-in + MenuExtended.dll - SaveToFolder add-in - my PSC code: CommonDialog Enhanced Callback - Enumerate Icon Resources - Network Change TCP/IP |
|
#4
|
|||
|
|||
|
Thanks
I´ll do this now ! |
![]() |
| Bookmarks |
| Tags |
| datasource, dbgrid, recordset |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Changing datasource property of datagrid at runtime... | premartha | ASP.NET | 1 | 11-19-2005 02:13 AM |
| print DbGrid problem | mona&Shuhada | VB Classic | 0 | 04-27-2001 12:09 AM |
| Field limeted in DBGrid V5.0 or V6.0 | Goran | VB Classic | 0 | 06-16-2000 09:19 AM |
| DBCombo in a DBGrid | FOXFI | VB Classic | 1 | 06-08-2000 02:32 PM |
| Re: How to set the DataSource to UserControl | Nick Koszykowski | VB Classic | 0 | 03-28-2000 03:21 PM |