Solved

Dbgrid with Sql

Posted on 2000-05-11
2
131 Views
Last Modified: 2010-05-18
I create a SQL’s string, but I don’t know what I have to do for load the results in a dbgrid, I mean, I want the data in which column. I need an example
to fill the columns with the results of the SQL's string.
0
Comment
Question by:JorgeLuis
2 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 50 total points
ID: 2802916
set the datasource of your dbgrid to the recordset you create via your sql string...if youre using a data control set its datasource equal to that...if youre using recordset objects
(e.g.,
Dim rs As Recordset
Set rs = New Recordset
rs.Open "Select * from Table")

then set the dbgrid's datasource equal to that recordset
0
 
LVL 2

Expert Comment

by:Simonac
ID: 2804376
Ti fill the dbgrid just do like azra suggested, but if u want to CHOOSE which field will be showed and in which column, u can right click on the dbgrid, go in properties, tab - columns and there u can specify field and column header for eacgh column, as well as how many column u want to see.

hopes this helps
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Specify ip address in my connection string for sas 2 59
MsgBox 2 54
vbModal 12 51
Excel VBA - Run Time error '1004' Application-defined or object-defined error 4 81
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question