Solved

VB6 - Datagrid question

Posted on 2013-12-13
3
249 Views
Last Modified: 2013-12-20
Hey guys,

I want to use ADODC object to populate a DataGrid ( I have already done this) then I want run SQL queries on the DataGrid instead of the live SQL database. Is this possible?
0
Comment
Question by:triphen
  • 2
3 Comments
 
LVL 29

Expert Comment

by:gowflow
ID: 39719032
sure it is made for that
can you give more details as what and if you have existing code so we can integrate ?
gowflow
0
 

Author Comment

by:triphen
ID: 39719225
basic code...

Form Load
ado1.recordset = "select * from products"
ado1.refresh

Datagrid1's datasource = ado1

So on load, Datagrid1 displays the entire products table. Now instead of querying the database again. I just want to query the data grid. Something like "select * from datagrid1 where active = 1"

I am trying to avoid constantly querying the database so I dont impact performance of the site. Is this possible?
0
 
LVL 29

Accepted Solution

by:
gowflow earned 500 total points
ID: 39719621
Well what you could do is something like this

ado1.RecordSource = "select * from products"
ado1.refresh
Set Datagrid1.DataSource = ado1

Now you can use the Filter property of the ado1.RecordSet to polupate what ever view you want in the DataGrid1 something like

Ado1.RecordSet.Filter = "Action = '1'"
then to show again all Data
Ado1.RecordSet.Filter = adFilterNone

gowflow
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

943 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

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now