In my application I have to execute a lot of stored procedures.
I have to write a lot of code for doing this.
For example :
_oconn.ConnectionString = _connectionString;
_oconn.Open();
SqlCommand ocmd = new SqlCommand();
ocmd.Connection = _oconn;
ocmd.CommandText = "procname";
ocmd.CommandType = CommandType.StoredProcedure;
ocmd.Parameters.Add("@Name", SqlDbType.NVarChar).Value = 'ABS';
ocmd.Parameters.Add("@ID", SqlDbType.Int).Value = 123;
var da = new SqlDataAdapter(ocmd);
da.Fill(Obj);
_oconn.Close();
I write this code for any procedure with different parameters,
Is there any way to write a function which do it for all my procedures?