# Make a Stored Procedure Call using .NET SDK

**URL:** <https://community.dreamfactory.com/t/make-a-stored-procedure-call-using-net-sdk/1473>\
**Category:** Client SDKs\
**Created:** [September 16, 2015, 6:47pm UTC](https://community.dreamfactory.com/t/make-a-stored-procedure-call-using-net-sdk/1473 "2015-09-16T18:47:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickedw](https://avatars.discourse-cdn.com/v4/letter/w/aeb1de/32.png) [@wickedw](https://community.dreamfactory.com/u/wickedw)\
**Post date:** [September 16, 2015, 6:47pm UTC](https://community.dreamfactory.com/t/make-a-stored-procedure-call-using-net-sdk/1473/1 "2015-09-16T18:47:07Z")

</div>

Hi,

I can see StoredProcRequest() in the .Net SDK, how do I use this to call a SQL Server stored procedure, with and without params?

Thanks for your help,  
Matt

---

<div class="post-metadata">

**Author:** ![makosovic](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/makosovic/32/384_2.png) [@makosovic](https://community.dreamfactory.com/u/makosovic)\
**Post date:** [September 17, 2015, 1:26pm UTC](https://community.dreamfactory.com/t/make-a-stored-procedure-call-using-net-sdk/1473/2 "2015-09-17T13:26:25Z")

</div>

Hi Matt,

First of all you want to instantiate RestContext and use the Factory to create an instance of DatabaseApi. Then you can call any of the CallStoredProc overloads. Following code snippet might help you get going.

`
IRestContext context = new RestContext("http://localhost:8080");
IDatabaseApi databaseApi = context.Factory.CreateDatabaseApi("my_db_service_name");
await databaseApi.CallStoredProcAsync(“my_stored_proc_without_params”);
StoreProcParamsBuilder builder = new StoreProcParamsBuilder();
builder.WithInParam(“id”, 1);
ResultDTO result = await databaseApi.CallStoredProcAsync(“my_stored_proc_with_param”, builder.Build());
`

Hope this helps.

Regards,  
Marko

---

<div class="post-metadata">

**Author:** ![wickedw](https://avatars.discourse-cdn.com/v4/letter/w/aeb1de/32.png) [@wickedw](https://community.dreamfactory.com/u/wickedw)\
**Post date:** [September 17, 2015, 6:14pm UTC](https://community.dreamfactory.com/t/make-a-stored-procedure-call-using-net-sdk/1473/3 "2015-09-17T18:14:24Z")

</div>

Hi Marko,

Really appreciate you taking the time to reply thanks.

I am trying the no params call first and getting -

500 - Failed to call database stored procedure.  
SQLSTATE[IMSSP]: The active result for the query contains no fields.

So at least thats a start, hope progress further when get a moment tommorow.

Thanks  
Matt
