Showing posts with label output. Show all posts
Showing posts with label output. Show all posts

Sunday, February 19, 2012

Accessing Stored Procedure parameters through XSD

Hi All,

I have created a stored procedure (in SQL Server 2005 - Developer) with input and output parameters. Please somebody let me know how I can call this store procedure from code behind using TableAdapter i.e. through XSD.

Thanks,

Long Live Microsoft ;)

You can start from here:Working with a Typed DataSet, and this tutorial should help:Working with Data in ASP.NET 2.0 :: Sorting Custom Paged Data. However if you just want to call the stored procedure from .net application, it should be?much easier to use SqlCommand/SqlDataAdapter.|||

Thanks for the response,

I have created a store procedure

CREATEPROCEDURE [GetUserDetails]

(

@.paramUserID INT ,

@.paramName VARCHAR(50) OUTPUT,

@.paramEmail VARCHAR(150) OUTPUT,

@.paramDOB DATETIME OUTPUT

…

…

--here more parameters will come

)

AS

BEGIN

SELECT

@.paramName = [Name]

,@.paramEmail =Email

,@.paramDOB = [DOB]

FROM

[Users]

WHERE

[UserID] = @.paramUserID

--more sql script will be here for additional parameters

END

I know we can easily call the strored procedure by using sqlcommand and adding sqlparameters etc.

But I have create the Dataset(xsd) in my application and I need to channel all my data operations through this.

I'v create a tableadapter for 'user' table and I need to add a query using existing stored proc 'GetUserDetails'. This procedure will expand cause I need to add another functionalities to it.

Please could you explaing how can I do this.

|||Well it's not a short explanation,?and?I?think?it's?better?to?follow?some?tutorial:

Working with Data in ASP.NET 2.0 :: Creating a Data Access Layer|||

Thanks Iori_Jay

Finally Igot the solution, and its working.

Myproblem was:

Executing stored procedure with inputand output parameters through XSD.

Stored Procedure

Posted earlier

User.xsd

TableAdapter: UserDetailsTableAdapter

Query: GetUserDetails(@.paramUserID,@.paramName, @.paramEmail, @.paramDOB)

Code to access outputparameter values

UsersTableAdapters.UserDetailsTableAdapterssobjGetUser =new UsersTableAdapters.UserDetailsTableAdapter();

String strName ="",

strEmail ="";

DateTime? dtDOB =DateTime.Now;

objGetUser.GetUserDetails(3/*userid*/, ref strName,refstrEmail,ref dtDOB);

Response.Write("<h3>UserDetails</h3>");

Response.Write("<strong>Name:</strong> " +strName);

Response.Write("<br/> <strong>Email:</strong>" + strEmail);

Response.Write("<br/><strong>DOB:</strong> " + dtDOB.ToString());


Although "System.String" and "string" are reference typesit showed error when "string" is used, so I used "String" instead of "string".

Added "?" to avail the reference property of value type "Datetime".

Sunday, February 12, 2012

accessing report programmatically

I need to run a report, output it in a CSV format, and store it in a
specified directory. I am able to do it using VS.net report designer.
How can I programmatically specify the output format and the
destination directory?
I'm new to RS, thanks for you help.Yes you can. There is a book by WROX called SQL Server Reporting Services.
It has a chapter on programmatic rendering. The book is a must have for
those learning SQL Server Report Services. It's very straight forward and
easy to implement.
David
"Mark" <maratg3@.hotmail.com> wrote in message
news:ffcd6d4.0410121336.5c27434e@.posting.google.com...
>I need to run a report, output it in a CSV format, and store it in a
> specified directory. I am able to do it using VS.net report designer.
> How can I programmatically specify the output format and the
> destination directory?
> I'm new to RS, thanks for you help.

Accessing output parameter in Stored Proc. using OBDC API...

hi pals,
I would like to ge the output parameter using ODBC API, say
SQLExecDirect("EXEC SP_New") . How could I get the output parameter value
from my application?
note: forgive me if this group is not a relevant one.
Thanks and Regards,
shahul.Hi
For bound parameters you can call SQLBindParameter
http://msdn.microsoft.com/library/d...r />
_729e.asp
Also check out:
http://msdn.microsoft.com/library/d...>
t10_7t2s.asp
and the sample ProcessReturnCodes.cpp.
More information is at
http://support.microsoft.com/defaul...kb;en-us;152174
For unbound parameters you can call SQLGetData e.g.
http://support.microsoft.com/defaul...kb;en-us;241147
John
"Shahul" wrote:

> hi pals,
> I would like to ge the output parameter using ODBC API, say
> SQLExecDirect("EXEC SP_New") . How could I get the output parameter value
> from my application?
> note: forgive me if this group is not a relevant one.
>
> Thanks and Regards,
> shahul.
>
>

Accessing output parameter in Stored Proc. using OBDC API...

hi pals,
I would like to ge the output parameter using ODBC API, say
SQLExecDirect("EXEC SP_New") . How could I get the output parameter value
from my application?
note: forgive me if this group is not a relevant one.
Thanks and Regards,
shahul.
Hi
For bound parameters you can call SQLBindParameter
http://msdn.microsoft.com/library/de...dbc_b_729e.asp
Also check out:
http://msdn.microsoft.com/library/de...cht10_7t2s.asp
and the sample ProcessReturnCodes.cpp.
More information is at
http://support.microsoft.com/default...b;en-us;152174
For unbound parameters you can call SQLGetData e.g.
http://support.microsoft.com/default...b;en-us;241147
John
"Shahul" wrote:

> hi pals,
> I would like to ge the output parameter using ODBC API, say
> SQLExecDirect("EXEC SP_New") . How could I get the output parameter value
> from my application?
> note: forgive me if this group is not a relevant one.
>
> Thanks and Regards,
> shahul.
>
>

Accessing output parameter in Stored Proc. using OBDC API...

hi pals,
I would like to ge the output parameter using ODBC API, say
SQLExecDirect("EXEC SP_New") . How could I get the output parameter value
from my application?
note: forgive me if this group is not a relevant one.
Thanks and Regards,
shahul.Hi
For bound parameters you can call SQLBindParameter
http://msdn.microsoft.com/library/d...r />
_729e.asp
Also check out:
http://msdn.microsoft.com/library/d...>
t10_7t2s.asp
and the sample ProcessReturnCodes.cpp.
More information is at
http://support.microsoft.com/defaul...kb;en-us;152174
For unbound parameters you can call SQLGetData e.g.
http://support.microsoft.com/defaul...kb;en-us;241147
John
"Shahul" wrote:

> hi pals,
> I would like to ge the output parameter using ODBC API, say
> SQLExecDirect("EXEC SP_New") . How could I get the output parameter value
> from my application?
> note: forgive me if this group is not a relevant one.
>
> Thanks and Regards,
> shahul.
>
>