.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Input Parameters

Posted By: dotnetbee     Posted Date: August 26, 2009    Points:2   Category :ASP.Net

Iam want Example Regarding Input Parameters or any link.

Pl send me.


Author: Nabin             
Posted Date: August 26, 2009     Points: 5   

Can u explain your question pls

Author: Akhil Raj       [Moderator]      
Posted Date: August 26, 2009     Points: 5   

it think you asking parameters for stored procedures..if yes please check the following


Author: Syed Shakeer Hussain             
Posted Date: August 27, 2009     Points: 5   

Hi dotnetbee,
Insert Data using Parameters through Stored Procedure.

First, create a stored procedure that may or may not accept parameters, and then call the stored procedure from within the code supply the necessary values if parameters are needed. The following example illustrates how to insert a new user in a users table that has a username and password field.

CREATE PROCEDURE [dbo].[InsertUser] (
@Username varchar(50),
@Password varchar(50)
) AS
INSERT INTO Users VALUES(@Username, @Password)

Note the DataType of Varchar(50) should be same as we created in a table for a column username and password

string username = textusername.Textstring password =txtpassword.TextSqlConnection conn = new SqlConnection("Data
Source=localhost;Database=MyDB;Integrated Security=SSPI");
SqlCommand command = new SqlCommand("InsertUser", conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@Username", SqlDbType.VarChar).Value = username;
command.Parameters.Add("@Password", SqlDbType.VarChar).Value = password;
int rows = command.ExecuteNonQuery();

see the follwoing Link article on storedpecudere written by me

Author: Nabin             
Posted Date: September 03, 2009     Points: 5   

I think sayed's answer will applicable for you.


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend