Solved

VB6 - Datagrid question

Posted on 2013-12-13
3
251 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to skip loop 6 57
VB6 Compile Compatibility Issue 4 102
MS SQL store procedure to calculate and return result 6 58
VB6 ListBox Question 4 44
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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