---
title: "stored Procedure usage in ASP.NET"  
description: "stored Procedure usage in ASP.NET"  
author: "Anonymous User"  
published: 2013-05-13  
updated: 2013-05-13  
canonical: https://www.mindstick.com/forum/880/stored-procedure-usage-in-asp-dot-net  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# stored Procedure usage in ASP.NET

Hi Expert!\
I want to used [stored procedure](https://www.mindstick.com/articles/803/using-stored-procedure-in-asp-dot-net) in my asp. [net application](https://answers.mindstick.com/qa/116657/should-i-push-appsettings-json-file-on-github-in-dot-net-application). I'm using [SQL Server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server) 2005. My line of code as following.\
create proc useGetASP @PartyCode nvarchar(50)asselect * from partyRegister where PartyCode=@PartyCodeGo\
I was trying to [execute](https://www.mindstick.com/interview/49/how-can-i-execute-a-php-script-using-command-line) it with [asp.net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder) [visual studio](https://www.mindstick.com/articles/12378/visual-studio-for-mac-is-out-of-beta-preview-now-officially-available) 2010.\
I'm try as following.\
cmd.CommandType = CommandType.StoredProcedureBut unfortunatly CommandType.StoredProcedure is not there , its not working.\
Hence i used:\
cmd.CommandType = SqlDataSourceCommandType.StoredProcedure;\
But this is also not working. It shows me red line below it [As comes when we type something invalid]. As a [tooltip](https://www.mindstick.com/articles/1529/simple-tooltip-using-html-css) it shows me error as: CommandType does not exists in current [context](https://www.mindstick.com/forum/23245/what-is-context-in-android)\
My Full Code:\
con.Open();cmd = new [SqlCommand](https://www.mindstick.com/forum/91/difference-between-sqlcommand-and-sqlcommandbuilder)("useGetASP",con);//cmd.CommandType =CommandType./*Not Working*/cmd.CommandType = SqlDataSourceCommandType.StoredProcedure;/*Also Not Working*/cmd.Parameters.AddWithValue("@PartyCode","0L036");\
what's I'm missing in my code?\
What command should I use for implementing stored procedure?\
Please Help Me.Any help will be appreciated.

## Replies

### Reply by AVADHESH PATEL

Hi Tanuj!\
Used StoredProcedure as following\
System.Data.CommandType.StoredProcedure\
I hope it helpful to you!


---

Original Source: https://www.mindstick.com/forum/880/stored-procedure-usage-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
