Home > Archive > FoxPro database connector > April 2005 > Using a COM to return data









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Using a COM to return data
Debbie

2005-04-07, 8:05 pm

I have a simple COM that works with web pages that checks account
information, returns prices for jobs and does other basic stuff. However, I
now need the COM to be able to return data to an ASP page for tracking job
status etc and I don't have a clue how best to do this. The only thing I
can think of is to have the COM use an SQL to extract the information
required, then copy it out to a throwaway table and pass the table name as a
reference back to the ASP page so that web designer can code his/her page to
pull everything out of that temp table and delete the table themselves when
they're done. I'm sure this isn't the way to do it, but it's the only thing
I can think of!

Could anyone tell me how I should be handling this problem?

Many thanks - Debbie


Craig Berntson

2005-04-07, 8:05 pm

You can return the data as an ADO record set or XML.

--
Craig Berntson
MCSD, Visual FoxPro MVP
www.craigberntson.com
Salt Lake City Fox User Group
www.slcfox.org
www.foxcentral.net


"Debbie" <britbitz@hotmail.com> wrote in message
news:vvidnePl3qeIJaj
fRVn-hw@adelphia.com...
>I have a simple COM that works with web pages that checks account
>information, returns prices for jobs and does other basic stuff. However,
>I now need the COM to be able to return data to an ASP page for tracking
>job status etc and I don't have a clue how best to do this. The only thing
>I can think of is to have the COM use an SQL to extract the information
>required, then copy it out to a throwaway table and pass the table name as
>a reference back to the ASP page so that web designer can code his/her page
>to pull everything out of that temp table and delete the table themselves
>when they're done. I'm sure this isn't the way to do it, but it's the only
>thing I can think of!
>
> Could anyone tell me how I should be handling this problem?
>
> Many thanks - Debbie
>
>



Debbie

2005-04-07, 8:05 pm

Thanks - but how exactly do I do that?!

I have seen several articles on the internet where the web designer is using
code to create connection strings etc to access databases and tables, but I
am not the one designing the ASP web pages and I wanted the web designer to
call a method in my COM that would pull the necessary data out of various
tables and pass the results back to the ASP page. I guess my main problem
is I don't have any understanding of how the whole process works - I was
hoping that the web designer could just create a instance of my COM, set its
DataPath property and then call a method to gather the data like below:

oCOM = Server.CreateObject("MyCOM.MyCOM")
oCOM.DataPath = " c:\trackingmodule\da
ta\"
oTrackingData = oCOM.GetData()

When you say "You can return the data as an ADO record set or XML", do you
mean the web designer would include the relevant code in the ASP page, or do
you mean I would actually write FoxPro code in my COM to do that? If its
the latter, (1) how do I do that, and (2) is the data returned as a cursor
or a table, and (3) who/how is the cursor or table closed.

Sorry to sound so stupid!

Debbie



"Craig Berntson" < iamcraig@iamcraigber
ntson.com> wrote in message
news:%237X4pGLKFHA.3832@TK2MSFTNGP12.phx.gbl...
> You can return the data as an ADO record set or XML.
>
> --
> Craig Berntson
> MCSD, Visual FoxPro MVP
> www.craigberntson.com
> Salt Lake City Fox User Group
> www.slcfox.org
> www.foxcentral.net
>
>
> "Debbie" <britbitz@hotmail.com> wrote in message
> news:vvidnePl3qeIJaj
fRVn-hw@adelphia.com...
>
>



Juan Alonso

2005-04-07, 8:05 pm

Hello Debbie.

I think this might help you out.

If you are still having problems I can send you more pages with "HOW TO"
articles.

Thanks and I hope it helps.

John.

"Debbie" <britbitz@hotmail.com> wrote in message
news:LcqdnXJ8Dac7Waj
fRVn-rg@adelphia.com...
> Thanks - but how exactly do I do that?!
>
> I have seen several articles on the internet where the web designer is
> using code to create connection strings etc to access databases and
> tables, but I am not the one designing the ASP web pages and I wanted the
> web designer to call a method in my COM that would pull the necessary data
> out of various tables and pass the results back to the ASP page. I guess
> my main problem is I don't have any understanding of how the whole process
> works - I was hoping that the web designer could just create a instance of
> my COM, set its DataPath property and then call a method to gather the
> data like below:
>
> oCOM = Server.CreateObject("MyCOM.MyCOM")
> oCOM.DataPath = " c:\trackingmodule\da
ta\"
> oTrackingData = oCOM.GetData()
>
> When you say "You can return the data as an ADO record set or XML", do you
> mean the web designer would include the relevant code in the ASP page, or
> do you mean I would actually write FoxPro code in my COM to do that? If
> its the latter, (1) how do I do that, and (2) is the data returned as a
> cursor or a table, and (3) who/how is the cursor or table closed.
>
> Sorry to sound so stupid!
>
> Debbie
>
>
>
> "Craig Berntson" < iamcraig@iamcraigber
ntson.com> wrote in message
> news:%237X4pGLKFHA.3832@TK2MSFTNGP12.phx.gbl...
>
>



DJ Hunt

2005-04-07, 8:05 pm

"Debbie" <britbitz@hotmail.com> wrote in message
news:LcqdnXJ8Dac7Waj
fRVn-rg@adelphia.com...
> Thanks - but how exactly do I do that?!



Might this help:

loConn = createobject([ADODB.Connection])
if vartype(loConn) = [O]
loConn.ConnectionString = [Driver=SQL
Server;Server=MySQLS
erver;Database=MyDat
abase;UID=User;PWD=P
assword]
loConn.Open()
endif

--
The Hacker's Guide to GoldMine 6.7 - http://www.dj-hunt.com/hg_toc3.htm

One-on-One GoldMine Technical Support ( Fee Based Service ) -
http://www.dj-hunt.com/gm_tech_support.htm

DJ Hunt

Phone: (978)342-3333
Email: DJ.Hunt@DJ-Hunt.com


Juan Alonso

2005-04-07, 8:05 pm

Hello Debbie.

I think this might help you out.

If you are still having problems I can send you more pages with "HOW TO"
articles.

Thanks and I hope it helps.
http://support.microsoft.com/kb/q152972/

John.


"Debbie" <britbitz@hotmail.com> wrote in message
news:LcqdnXJ8Dac7Waj
fRVn-rg@adelphia.com...
> Thanks - but how exactly do I do that?!
>
> I have seen several articles on the internet where the web designer is
> using code to create connection strings etc to access databases and
> tables, but I am not the one designing the ASP web pages and I wanted the
> web designer to call a method in my COM that would pull the necessary data
> out of various tables and pass the results back to the ASP page. I guess
> my main problem is I don't have any understanding of how the whole process
> works - I was hoping that the web designer could just create a instance of
> my COM, set its DataPath property and then call a method to gather the
> data like below:
>
> oCOM = Server.CreateObject("MyCOM.MyCOM")
> oCOM.DataPath = " c:\trackingmodule\da
ta\"
> oTrackingData = oCOM.GetData()
>
> When you say "You can return the data as an ADO record set or XML", do you
> mean the web designer would include the relevant code in the ASP page, or
> do you mean I would actually write FoxPro code in my COM to do that? If
> its the latter, (1) how do I do that, and (2) is the data returned as a
> cursor or a table, and (3) who/how is the cursor or table closed.
>
> Sorry to sound so stupid!
>
> Debbie
>
>
>
> "Craig Berntson" < iamcraig@iamcraigber
ntson.com> wrote in message
> news:%237X4pGLKFHA.3832@TK2MSFTNGP12.phx.gbl...
>
>



Juan Alonso

2005-04-07, 8:05 pm

Sorry.. This is what I wante to send.

http://fox.wikis.com/wc.dll?Wiki~ASPandVFP~VFP

My mistake.. had the wrong site in clipboard...lol

John.

"Juan Alonso" <jacinc2@hotmail.com> wrote in message
news:eyo8HXMKFHA.484@TK2MSFTNGP15.phx.gbl...
> Hello Debbie.
>
> I think this might help you out.
>
> If you are still having problems I can send you more pages with "HOW TO"
> articles.
>
> Thanks and I hope it helps.
> http://support.microsoft.com/kb/q152972/
>
> John.
>
>
> "Debbie" <britbitz@hotmail.com> wrote in message
> news:LcqdnXJ8Dac7Waj
fRVn-rg@adelphia.com...
>
>



Claude Fox

2005-04-07, 8:05 pm

Debbie,
Make sure you've compiled the vfp part to an mtdll woth OLEPUBLIC keyword in
your class and you should be able to interop with ASP or ASp.NET seamlessly
like:
(ASP)
<%
Session.Timeout = 1440
Response.Expires=0
Set oServer = Server.CreateObject("MyTest.server")
Set oServer = oServer.GetDebugObject()
Response.Write(oServer.process())
%>
OR
(ASP.NET)
<% @Page Language="C#" ASPCompat="true" %>
<% @Import Namespace="mytest_dotnetproxy" %>
<%
server x ;
x = new server() ;
try
{
Response.Write(x.process());
}
catch(Exception ex)
{
Response.Write("Caught .NET exception, source: " + ex.Source + "
message: " + ex.Message);
}

%>
This works great and you can pass objects back and forth between the
environments...

"Debbie" <britbitz@hotmail.com> wrote in message
news:vvidnePl3qeIJaj
fRVn-hw@adelphia.com...
>I have a simple COM that works with web pages that checks account
>information, returns prices for jobs and does other basic stuff. However,
>I now need the COM to be able to return data to an ASP page for tracking
>job status etc and I don't have a clue how best to do this. The only thing
>I can think of is to have the COM use an SQL to extract the information
>required, then copy it out to a throwaway table and pass the table name as
>a reference back to the ASP page so that web designer can code his/her page
>to pull everything out of that temp table and delete the table themselves
>when they're done. I'm sure this isn't the way to do it, but it's the only
>thing I can think of!
>
> Could anyone tell me how I should be handling this problem?
>
> Many thanks - Debbie
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com