?
Solved

How can i get a VB application to be the source of a recordset?

Posted on 2003-03-10
16
Medium Priority
?
230 Views
Last Modified: 2010-05-01
Is it possible to obtain a recordset from a VB application?
Or the opposite, as if a VB application can be a source for a new recordset?
let,s say i have an app that is connected to my database Customer. That application get all the data, modified them as i need them, then, return a full recordset
and, with my second application, i set my recordset's source upon the results of the first app
is that possible?
thanks
-ErayMan
0
Comment
Question by:erayman
[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
  • 8
  • 4
  • 2
  • +2
16 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8103715
One way of doing this is that the source application persist the recordset (with tthe .Save method) while the second one uses .Open to get it.
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 8103720
Sure, of course you can done that (in common ADO or DAO connection). We can do whatever we wanted based on the logic and application requirement..

Here is a link to many database connection examples:
http://www.vbcode.com/asp/code.asp?lstCategory=Database

Hope this helps
0
 
LVL 7

Expert Comment

by:Smallint
ID: 8103919
An example of how to create a recordset

Set Results = New ADODB.Recordset

Results.Fields.Append "Field1", adChar, 100
Results.Fields.Append "Field2", adInteger
Results.Open

'Now you can add records
Results.AddNew
Results.Fields("Field1") = "Record1"
Results.Fields("Field2") = 1
Results.Update

Results.AddNew
Results.Fields("Field1") = "Record2"
Results.Fields("Field2") = 2
Results.Update
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:erayman
ID: 8104025
ok, thanks guys
in addition to what smallint said and what emoreau suggest,
if i write:
Results.Save
how can i get it with my other app in runtime?
like:
    Dim SQLRecordSet As Recordset    ' Recordset Ado
    Set SQLRecordSet = ' Calls App that return a record set
                       ' so that everything is done runtime


-ErayMan
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8104066
Dim SQLRecordSet As new Recordset    ' Recordset Ado
SQLRecordSet.open "c:\test.rs"
0
 

Author Comment

by:erayman
ID: 8104073
ok, thanks guys
in addition to what smallint said and what emoreau suggest,
if i write:
Results.Save
how can i get it with my other app in runtime?
like:
    Dim SQLRecordSet As Recordset    ' Recordset Ado
    Set SQLRecordSet = ' Calls App that return a record set
                       ' so that everything is done runtime


-ErayMan
0
 

Author Comment

by:erayman
ID: 8104151
wo, sorry for the last post, my bad

is there a way to have the record set not stored in a file, but instead, in something like ShowData.exe, picking it up like:

Dim SQLRecordSet As new Recordset    ' Recordset Ado
SQLRecordSet.open "c:\GetData.exe"

and in GetData.exe is an app that set the connection with the DB, reads data, then return them in a recordset form.

I want to do this, because it would help maintaining the system, as if i want to change the format of some data i get from the DB, i can change it inside GetData.exe, and it would not change a thing in ShowData.exe.

This is getting helpful when you got many app, like GetData.exe, getDataCustomer.exe, GetDataEmployee.exe, etc, and you want to change a single things without affecting the rest.

Then you just call ShowData.exe, and everything is shown, without having to first call all the other apps and having them write their files on the disk, then reading from them
So by linking them all together, it'd simplifies things

I don't know if you see what i mean, well, thanks for your always quick answer!
-ErayMan


0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8104642
it is a lot of overhead to do this. Have you think to create Stored Procedures instead.
0
 

Author Comment

by:erayman
ID: 8104917
Well, it is because not all of the parts would be running client-side
depending on how the project advances, i think it would be better for some of the parts to runs server-side, such as a part that would have direct access to odbc, and some parts that would be running client-side and can only get recordset from the server apps
This way, we can decide to make a module multi-user while others are mono-user
This could also decrease the number of connection made with the DB

Well, thank you for your help
-ErayMan
0
 

Author Comment

by:erayman
ID: 8104960
Well, it is because not all of the parts would be running client-side
depending on how the project advances, i think it would be better for some of the parts to runs server-side, such as a part that would have direct access to odbc, and some parts that would be running client-side and can only get recordset from the server apps
This way, we can decide to make a module multi-user while others are mono-user
This could also decrease the number of connection made with the DB

Well, thank you for your help
-ErayMan
0
 

Author Comment

by:erayman
ID: 8105374
truly sorry for the duplicates posts
Don't know how i did it, eh
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8105635
because you are using the browser refresh button.
0
 
LVL 3

Accepted Solution

by:
PhiliP earned 225 total points
ID: 8106848
Seems your looking at N-tier development. By creating activeX dll's running under MTS or COM+ services you can devide your application logic into components on multiple machines.
Have a look into distributed application design on MDSN.
0
 

Author Comment

by:erayman
ID: 8111657
that's exactly what i'm trying to do, thanks PhiliP
However, on mdsn they talk about things you should do, things you shouldn't, "Choosing the Right Template for Your Distributed Application", as they state it, but, i couldn't find any help on how to do this

In one of my vb book, they talk about activeX control data source, using the "microsoft data binding collection" reference and the
sub Class_GetDataMember(DataMember As String, Data As Object)
  Set Data = DataEnvironment1.Command1
End Sub

I don't know if you know that
They also say things about linking the activeX APP with the exe APP using an BindingCollection object

I tried all that, but i got an error upon compilation that say : ActiveX object cannot be created

Well, i don't know if you can help me, or give me some suggestions, well, in any case, thanks for your troubles
-ErayMan
0
 
LVL 3

Expert Comment

by:PhiliP
ID: 8111843
Ok then take a look at the duwamish sample application.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnduwcol/html/sampleapp06012000.asp
or look at the Fitch & Mather Stocks demo

But be aware of the stuff your getting yourself into. It took me about 1 year to become an expert on distributed applications.

0
 

Author Comment

by:erayman
ID: 8114512
well thanks a lot PhiliP, that helped me indeed, and also everyone that answered me
-ErayMan
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

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…
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.
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…
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…
Suggested Courses
Course of the Month15 days, 7 hours left to enroll

741 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