Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Aspect Script and SQL

Status
Not open for further replies.

Diggo

Technical User
May 10, 2002
2
FR
Hi,

I'm trying to use an sql db to provide info and a procomm script to act-on and use the data.
Has anybody tried anything like this?
I'm thinking of writing c++ program to retrieve a line of data and maybe dump it into a file and get procomm to read the file (fget etc).

Any thoughts?

Thanks,

Diggo.
 
I've not used SQL much, but I imagine it supports DDE, which ASPECT support as well. You could write an ASPECT script that use the various dde* commands to communicate with SQL and retrieve information in that manner. There are some example scripts in the discussion of the various commands that should get you started.

Procomm could also act as a DDE server that SQL may be able to access (I have no idea if SQL can only run as a DDE server or as a DDE client as well). If this can be done in SQL, then the Procomm Plus as a DDE Server topic in the ASPECT help file would be of use to you.
 
If you can Transfer the SQL Data to Excel, I might be able to help you out. If I understand your question, you want Procomm to Extract the Data and save it to a File.

If this correct, let me know.. I've been playing with DDE and Excel and have a Few Commands that I could share. Give me a Few Days to Play with the Retrieval from Excel. Most what I have come up with is to Send Data to Excel, not the Retrieval Side; but I have a Few Ideas that I will Play with...
 
Thanks for the response,

At the moment I retrieve my data from an excel file on a network share, but the problem is with remote access we have 2 domains and i just want users to pick up an Ip address not log onto NT network and have access to the database. (I hope i make sense!)

I hasn't given much thought to DDE any further info would be great.

Thanks,

Diggo.
 
What kind of database is it? If you are running sqlplus (oracle) on a unix box and you can telnet onto that unix box then you can run just about any kind of sql statement/query.

The following script reads data in from a local file into an array, formats it into an sql update statement then loops until all lines in the local file have been read. Lines in the local file need to be terminated with a comma. Hope this gives you some ideas.

string extn
string old[255]
integer Count = 0
integer i = 0
integer Loops = 0

proc main

transmit "sqlplus"
transmit "^M"
pause 1
transmit "LOGIN"
transmit "^M"
pause 1
transmit "PASSWORD"
transmit "^M"
pause 1
moo()
endproc

proc moo

fopen 0 "c:\octcom\dels.txt" READ

while not feof 0
fgets 0 extn

strtok old[Count] extn "," 1

if (Count += 1) == 254

exitwhile
endif ;
endwhile
fclose 0
count = 0
while (i<255)
pause 1
transmit &quot;update mailbox set reqname = 'AUDIT' where mbx = &quot;
transmit &quot;&quot;
transmit old[count]
pause 1

transmit &quot; and deldate is null and contid = 'KPM01'&quot;
pause 1
transmit &quot;^M&quot;
pause 1

transmit &quot;/&quot;
pause 1

transmit &quot;^M&quot;
pause 1


transmit &quot;update mailbox set deldate = '31-MAY-02' where mbx = &quot;

transmit &quot;&quot;
transmit old[count]


transmit &quot; and deldate is null and contid = 'KPM01'&quot;
pause 1

transmit &quot;^M&quot;
;pause 1

transmit &quot;/&quot;
pause 1

transmit &quot;^M&quot;
pause 1


i++
count++
endwhile

endproc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top