Showing posts with label app. Show all posts
Showing posts with label app. Show all posts

Monday, March 12, 2012

How to return a value from Stored Procedure?

Hi,
I am calling a stored procedure from my Java script app and trying to use
the returned value later on in my app.
Here is the javascript code.
var connObj = Server.CreateObject("ADODB.connection");
connObj.Open("DRIVER={ SQL Server }; SERVER = 9.1.2.1;
DATABASE=TEST","sa","xyz");
var recordSetObj = Server.CreateObject("ADODB.Recordset");
var StrName = "venkat";
var RetVal;
var query = "Exec ProcSP '"+StrName+'", '"+RetVal+"'";
recordSetObj.Open(query,connObj);
Response.Write("Return Value= "+RetVal);
/******Stored Procedure********/
Create Procedure ProcSP
@.StrName nvarchar(10),
@.RetVal integer OUTPUT
AS
SET RetVal = 1
return
GO
The value returned is empty, even if I initialize RetVal to 2 say before the
call of Store procedure then once the execution of stored procedure is
finished it prints as 2 only. It is not getting changed to 1.
Please note the stored procedure is working fine if i execute any queries, i
mean the stored procedure is getting called from the app and is working
properly the only thing is i am not able to return any value from it.
I greatly appreciate anyhelp on this, i need to fix this issue ASAP, i am
running short of time. Please help me.
Regards,
VenkatHave you tried using parameters and the command object?
That's typically how you retrieve the values of output
parameters and return values in ADO.
-Sue
On Fri, 28 Nov 2003 11:09:31 +0530, "Venkat"
<venkat_kp@.yahoo.com> wrote:
quote:

>Hi,
>I am calling a stored procedure from my Java script app and trying to use
>the returned value later on in my app.
>Here is the javascript code.
>var connObj = Server.CreateObject("ADODB.connection");
>connObj.Open("DRIVER={ SQL Server }; SERVER = 9.1.2.1;
>DATABASE=TEST","sa","xyz");
>var recordSetObj = Server.CreateObject("ADODB.Recordset");
>var StrName = "venkat";
>var RetVal;
>var query = "Exec ProcSP '"+StrName+'", '"+RetVal+"'";
>recordSetObj.Open(query,connObj);
>Response.Write("Return Value= "+RetVal);
>
>/******Stored Procedure********/
>Create Procedure ProcSP
>@.StrName nvarchar(10),
>@.RetVal integer OUTPUT
>AS
>SET RetVal = 1
>return
>GO
>
>The value returned is empty, even if I initialize RetVal to 2 say before th
e
>call of Store procedure then once the execution of stored procedure is
>finished it prints as 2 only. It is not getting changed to 1.
>Please note the stored procedure is working fine if i execute any queries,
i
>mean the stored procedure is getting called from the app and is working
>properly the only thing is i am not able to return any value from it.
>
>I greatly appreciate anyhelp on this, i need to fix this issue ASAP, i am
>running short of time. Please help me.
>
>Regards,
>Venkat
>
>
>

Wednesday, March 7, 2012

How to retrieve system oledb Provider list

In my app I have to list of "oledb provider" to let the user choose the connection method. As follow:
1.Jet 4.0 OLE DB Provider
2.OLE DB Provider for DTS Packages
3.OLEDB Provider for Indexing Service
4.OLEDB Provider for ODBC Drivers
5.OLEDB Provider for OLAP Services
6.OLEDB Provider for Olap Services 8.0
7.OLEDB Provider for Oracle
8.OLEDB Provider for SQL Server
9.OLEDB Simple Provide
Which doesn't not support must be disabled.
Use which funciton can retrieve the Provider list of system or something like that.
Thanks.
--Master..xp_enum_oledb_providers

If you want to keep the resule,Create a table with the column returned by the above query.And

insert into OLEDB_Providers exec Master..xp_enum_oledb_providers|||en ... I still do not know how ..
where is the master..xp_enum_oledb_providers
is that a function?
can show me a sample ?
many thanks.
Originally posted by ClaireHsu
Master..xp_enum_oledb_providers

If you want to keep the resule,Create a table with the column returned by the above query.And

insert into OLEDB_Providers exec Master..xp_enum_oledb_providers|||Can show me a sample code to list the oledb providers of current system.
Thanks.|||I really want to know does the system support:

1.SQLOLEDB
2.DTSPackageDSO
3.SQLReplication.OLEDB
4.MSDataShape
5.VSEE Versioning Enlistment Manager Proxy Data Source
6.ADsDSOObject
7.MSOLAP
8.MSDAIPP.DSO
9.MSDASQL
10.MSDASQL Enumerator
11.Microsoft.Jet.OLEDB.4.0
12.Microsoft.Jet.OLEDB.3.51
13.SQLOLEDB Enumerator
14.MSDAOSP
15.MSDAORA
...
How to perform this check/text of the user's system in my app.
In my app the unsupport oledb provider must be visable.
--
Thanks.