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
What are the different ado.net namespaces?
What is ole in excel?
What is the usage of the dataset object in ado.net?
What is the difference between the clone() and copy() methods of the dataset class?
how Sequence to connect and retrieve data from database using dataset?
What is sqldatareader?
how can implement dropdownlist in particular of dataset when try to update?
What are the advantage of ado.net?
If a table contains 20000 records. In a page at each time 100 records to be displayed.
What is executequery?
What is adodb dll?
How to identify the controls which can be used for binding data?
Which provider is used to connect ms access, oracle, etc…?
What Is Difference Between Ado And Ado.net?
What is ado.net object model?