Parametrized Query 
Author Message
 Parametrized Query

I have created a Recordset by using a command object
having one parameter object.

set Rs = cmd.Execute

now i want to requery the record set by changing the value
of command's parameter.

how to do tha ??

i tried the requery method o rs and get the following error

Thanks in advance
Shahid Saleem



Sat, 21 Aug 2004 16:21:08 GMT  
 Parametrized Query
Shahid,
here's a sample code with ado parameters

Dim objConn
Dim objCmd

'Instantiate objects
Set objConn             = Server.CreateObject("ADODB.Connection")
set objCmd              = Server.CreateObject("ADODB.Command")
conn.Open Application("ConnectionString")

With objCmd
    .ActiveConnection = conn 'You can also just specify a connection
string here
    .CommandText = "sp_InsertArticle"
    .CommandType = adCmdStoredProc 'Requires the adovbs.inc file or
typelib meta tag

    'Add Input Parameters

adParamInput, , columnist_id)

255, url)

adParamInput, 99, url)

                adParamInput, 2147483647, description)

    'Add Output Parameters

adParamOutput, , 0)

    'Execute the function
    'If not returning a recordset, use the adExecuteNoRecords parameter
option
    .Execute, , adExecuteNoRecords

End With

The source for this stored procedure is:

Create PROCEDURE dbo.sp_InsertArticle
(





)
AS
BEGIN
        INSERT INTO dbo.t_link  (columnist_id,url,title,description)


END

--
hth
Hirantha S. Hettiarachchi MCSD,MCDBA,OCP

Please reply only to the newsgroups.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sat, 21 Aug 2004 18:40:25 GMT  
 Parametrized Query
Hi,

To do so, just assign new values to parameter and opene
recordset same way as you did it before. If you need to
opene recordser, using same recordset variable (Rs), then
first you need to close previously opened recordset

Val

Quote:
>-----Original Message-----
>I have created a Recordset by using a command object
>having one parameter object.

>set Rs = cmd.Execute

>now i want to requery the record set by changing the
value
>of command's parameter.

>how to do tha ??

>i tried the requery method o rs and get the following
error
>" Procedure RetriveDistricts, expects parameter

>Thanks in advance
>Shahid Saleem

>.



Sat, 21 Aug 2004 20:40:20 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Executing parametrized queries in ADODC component

2. SQLBase, ODBC and Parametrized Queries

3. Crystal and parametrized queries

4. Parametrized Query with Optional TOP Predicate

5. VB crashe when calling parametrized query within dataEnvironment

6. VB/ADO parametrized queries

7. parametrized query

8. Parametrized create table query

9. Parametrized SQL-queries with ODBC interface

10. calling Parametrized Access 2000 query

11. HELP: Parametrized union queries don't work with Jet 4.0

12. Parametrized Report

 

 
Powered by phpBB® Forum Software