How does u call and execute a SP in .NET?

Showing Answers 1 - 4 of 4 Answers

Praveen Kumar

  • Sep 23rd, 2005
 

public DataSet SampleToExecute_SP_IN_DOTNET() { DataSet DataSetHome = new DataSet(); SqlConnection SqlConnectionHome=new SqlConnection(strConnectionString); SqlCommand SqlCommandHome=new SqlCommand(); SqlCommandHome.Connection = SqlConnectionHomeReportCheck; SqlCommandHome.CommandText = "CLM_getCurYearStatistics"; SqlCommandHome.CommandType = CommandType.StoredProcedure; SqlDataAdapter DataAdapterHome = new SqlDataAdapter(SqlCommandHome); try { DataAdapterHome.Fill (DataSetHome); return DataSetHome; } catch(SqlException ex) { throw(ex); } catch(Exception ex) { throw(ex); } finally { DataAdapterHome.Dispose (); SqlCommandHome.Dispose(); SqlConnectionHome.Close(); } }

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions