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


Top 5 Contributors of the Month
david stephan

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
Hi,

Iam want Example Regarding Input Parameters or any link.

Pl send me.


Dotnetbee............

Responses
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

http://www.sqlservercentral.com/articles/Stored+Procedures/usingparameterswithstoredprocedures/2004/


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;
conn.Open();
int rows = command.ExecuteNonQuery();
conn.Close();


see the follwoing Link article on storedpecudere written by me
http://www.dotnetspark.com/kb/531-insert-data-using-parameters-through-stored.aspx

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

hi,
I think sayed's answer will applicable for you.


Nabin



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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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