-
Procedure from ASP to SQL7
Hi, i have an iss with some asp-scripts. it´s connected with an ms-sql7 server. i use commands like SELECT,INSERT,UPDATE to access the database via odbc. from now i want to use some stored procedures on the sql-server to modify my tabels.
how can i start the procedures by an command in the asp-script?
(must use the EXEC command?!)
i´m very thankfull for every kind of help
-
Basic method:
Dim dbConn
Dim rs
' Create & Open your db connection
' For a SP which returns a record set
Set Rs = dbConn.Execute (your sp as string)
' Process your record set
' For a SP which does not return a record set
dbConn.Execute (your sp as string)
' Cleanup.....
Last edited by andi_g69; 01-25-2003 at 08:11 AM.
-
first of all i want to thank you for your answer! but now i have some further questions...
i tried a procedure with the "querry analyzer"
there i had to ad the decalration of some variables (eg. declare @a varchar(2) ). isn´t this necessary in the asp? how can i give parameters to the sql-server with the string?
for what stands the "Dim"-command in your example?
-
Although not neccessary in VBScript a "DIM" statement is used for variable declaration. It is always better to declare the variables you are using.
Let's take a sample SP:
CREATE PROCEDURE test (
@param varchar (10) ) AS
SELECT *
FROM tbltest
where name like @param
Taken you get you parameter from an input field named parameter in a HTML form you build your SP call like this:
sQuery = " test @param = " & Request ("parameter")
Set RS = dbConn.Execute (sQuery)
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
|
|