Hi Kishore, Assume that your SP, named "StoredProcedureName", takes a single input parameter and returns an output. CREATE PROCEDURE StoredProcedureName @ProductCode [nvarchar](20), @Control [nvarchar](20) OUTPUT WITH EXECUTE AS CALLER AS BEGIN select @Control = columnname from traceparameters where keyLabel = 'Test' return @Control END In your code create a SqlParameter object as Sqlparameter parameter; Creare a connection string and open the connection... Create a command object and assign the connection object to it.. In case you have a stored procedure set the commandtype property of command object to storedprocedure. The name of the stored procedure will assigned to the commandtext property So u r code will look like this.. SqlCommand command; SqlParameter parameter; string columnName = null; try { using (SqlConnection dbConnection = Connection()) { command = new SqlCommand(); command.Connection = dbConnection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "StoredProcedureName"; parameter = new SqlParameter("@ProductCode", SqlDbType.NVarChar, 20); parameter.Value = ProductCode; command.Parameters.Add(parameter); parameter = new SqlParameter("@Control", SqlDbType.NVarChar, 20); parameter.Direction = ParameterDirection.Output; command.Parameters.Add(parameter); command.ExecuteNonQuery(); columnName = command.Parameters["@Control"].Value.ToString(); return columnName; } } catch (Exception ex) { throw new Exception("Stored Procedure Failed" + ex.ToString()); } This is for a SQL backend... Use the same logic for other database... Hope i got u r question right.... Need any help, do post a msg back.. Happy Coding.. |