store procedure
C#
2
Posts
2
Posters
0
Views
1
Watching
-
how to call storeprocedure in page load event i have string strCmd = "exec rpt_OnlineStoreActivity '01/01/2000', '07/30/2007'"; can some if this is wirght away to do it. thank you
may i see u'r stored procedure code? if u use stored procedure for the query,next thing u must do is call stored procedure..or i'm missing something about your question? for example on page load events i write this code:
string Connection = ConfigurationManager.ConnectionStrings["Connect"].ConnectionString; SqlConnection conn = new SqlConnection (Connection); conn.Open(); SqlCommand cmd = new SqlCommand("sp_SelectAllData", conn); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); return dt;
note : i already have a stored procedure name sp_SelectAllData in my database but try using Data Access Layer, Bussiness Logic..so if u want some change in u'r interface u don't have much trouble to change your code Kind Regards, Tomi