Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB6 - Datagrid question

Posted on 2013-12-13
3
Medium Priority
?
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 31

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 31

Accepted Solution

by:
gowflow earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

596 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