|
-
Aug 1st, 2000, 03:37 AM
#1
Thread Starter
Hyperactive Member
I'm using VB6 and SQL7 and I need to pass 4 parameters across to my SP and then I want it to return a message, what's the easiest way to do this as I'm new to SQL.
The stored prodecure works fine as this has already been tested
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
-
Aug 1st, 2000, 10:16 AM
#2
Junior Member
create a connection to the database through the data enviroment .
in the data view window create the stored proc
transact sql (sql server db language)
eg
Create or Replace PROCEDURE CustOrdersDetail (declare varables)
(
@OrderID int
)
AS
(command text)
SELECT ProductName,
UnitPrice=ROUND(Od.UnitPrice, 2),
Quantity,
Discount=CONVERT(int, Discount * 100),
ExtendedPrice=ROUND(CONVERT(money, Quantity * (1 - Discount) * Od.UnitPrice), 2)
FROM Products P, [Order Details] Od
WHERE Od.ProductID = P.ProductID and Od.OrderID = @OrderID
save it to the data base
this code will take 1 param and the return a record set
insert this sp in to the dataeviroment so you can acsess it!
you can now acsess use this sp any time by calling it through the data env
hope this is help ful!!!
-
Aug 1st, 2000, 03:11 PM
#3
Thread Starter
Hyperactive Member
Thanks for that, but I'm not using the DE, just using simple code. Or would you recomment using the DE instead of code
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
-
Aug 1st, 2000, 11:24 PM
#4
Guru
Is the message you have to return being returned by the SP?
-
Aug 2nd, 2000, 02:43 AM
#5
Thread Starter
Hyperactive Member
Yes the message I need to return is coming from the SP
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
-
Aug 2nd, 2000, 03:51 AM
#6
Junior Member
first off i would use the de enviroment cus once its set up it will make its easy and quicker (very easy & and very quick) to develop data base project and you can also create the stored procs through the data eviroment (tables ,database diagrams,views ect)so u dont need to use the sql server interface at all (after youve created the db)
but if you must heres some code to call a stored porc manually!!!
dim objspcomand as adodb.command
dim pr_insert(2) as variant
set objspcomand = new adodb.command
objspcommand.activeconnection = objactiveconnection
objspcommand.comandtype = adcmdstoredproc
objspcommand.comandtext = "insert_jobs"
pr_insert(0) = "president"
pr_insert(1) = 50
pr_insert(2) = 250
objspcommande.execute , pr_insert
set objspcommand = nothing
as you can see its pritty long winded
i think the code is pritty self explanatry pr_insert are the parameters u are passing.
hope this is helpful but try the data enviroment way first its lot better.
-
Aug 2nd, 2000, 04:02 AM
#7
Thread Starter
Hyperactive Member
Thanks that worked fine. I'll give the DE a try
Thanks in advance for any help provided.
VB 6 Enterprise Edition SP4
ADO, SQL 7/2000, ASP and some JavaScript

>> Life goes on, but for how long? <<
If you can smile when things go wrong, you have someone in mind to blame
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|