Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Call a stored procedure from ado.net and pass parameter to it ?

Answer Posted / dinesh gupta

string
ConnectionString= "server="+DatabaseSrvr+";database="+Datab
aseNam+";user id="+DatabaseUsr+";password="+DatabasePass
;

Sqlconnection Cn = new SqlConnection(ConnectionString);
Cn.Open();

SqlCommand cmd = new SqlCommand("PROCNAME", Cn);

cmd.CommandType = CommandType.StoredProcedure;

SqlParameter p = new SqlParameter();

p = new SqlParameter();
p.ParameterName = "@parameter1";
p.SqlDbType = SqlDbType.VarChar;
p.Size = 10;
p.Value = "abc";
p.Direction = ParameterDirection.Input;
cmd.Parameters.Add(p);

p = new SqlParameter();
p.ParameterName = "@parameter2";
p.SqlDbType = SqlDbType.Int;
p.Value = Convert.ToInt16(textbox.text);
p.Direction = ParameterDirection.Input;
cmd.Parameters.Add(p);


cmd.ExecuteNonQuery();

Is This Answer Correct ?    8 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different ado.net namespaces?

1012


What is ole in excel?

896


What is the usage of the dataset object in ado.net?

910


What is the difference between the clone() and copy() methods of the dataset class?

1013


how Sequence to connect and retrieve data from database using dataset?

1212


What is sqldatareader?

871


how can implement dropdownlist in particular of dataset when try to update?

2719


What are the advantage of ado.net?

930


If a table contains 20000 records. In a page at each time 100 records to be displayed.

838


What is executequery?

891


What is adodb dll?

949


How to identify the controls which can be used for binding data?

951


Which provider is used to connect ms access, oracle, etc…?

943


What Is Difference Between Ado And Ado.net?

973


What is ado.net object model?

914