??????????????У????????`ExecuteSQLStatement`???????????SQL???????????`ExecuteStoredProcedure`????????
???????????`resultDataReader`??`.Read()`?????????????????????????????????Щhelper???????????????????NULL??Ρ?GetIntValueOfDBField???????????
?????????????SQL?????????洢????????????ExecuteSQLStatement??userData??????
????ReaderQueryCallbackResult userData;
???????????з???recordset????????????userData.resultDataReader????????recordset??????
????NonQueryCallbackResult userData
????????????UPDATE??????з??????????????????userData.AffectedRows?????е?????
????ScalarQueryCallbackResult userData
?????????????????????????????????????`SELECT code FROM tbl WHEN ID=10`?????userData.ScalarValue??÷????????
????????洢??????????????????ExecuteStoredProcedure?????????????????????????????????洢??????????????
????StoredProcedureCallbackResult userData(eRequestType)
????????????????????????????????????
??????????????
????????????????????????????????????????????`WaitSqlCompletes`????????????????????????
????///<summary>
????///???????????????WaitSqlCompletes(userData??10)
????///?????????????!
????///</summary>
????public StoredProcedureCallbackResult MyStoreProcedureASYNC(int param1??string param2)
????{
????//Create user data according to return type of store procedure in SQL
????StoredProcedureCallbackResult userData=new StoredProcedureCallbackResult(eRequestType.Reader);
????//If your store procedure accepts some parameters??define them here??
????//or you can omit it incase there is no parameter definition
????userData.Parameters=new System.Data.SqlClient.SqlParameter[]{
????new System.Data.SqlClient.SqlParameter("@param1"??param1)??
????new System.Data.SqlClient.SqlParameter("@param2"??param2)??
????};
????//Execute procedure...
????if(!ExecuteStoredProcedure("usp_MyStoreProcedure"??userData))
????throw new Exception("Execution failed");
????return userData;
????}
?????????????????????????:
????...
????DAL.StoredProcedureCallbackResult userData=myDal.MyStoreProcedureASYNC(10??"hello");
????...
????//each time we wait 10 milliseconds to see the result...
????switch(myDal.WaitSqlCompletes(userData??10))
????{
????case eWaitForSQLResult.Waiting:
????goto WAIT_MORE;
????case eWaitForSQLResult.Success:
????goto GET_THE_RESULT;
????default:
????goto EXECUTION_FAILED;
????}
????...
???????????
??????BLL??????????????????????????????????????????????(?????????????????)??OnDatabaseStatusChanged?????????
??????????????????????????????ι??????????μ??????????
???????????
?????????????????????????????????????е?????????connection timeout????SQL???????????????execution timeout??????????
??????????????????????????????????????????ж???????????????Щ?????????????????е??????????????
??????Σ?????????????????????????????????????????????30??????????????????????????????????????????????????
????userData.tsWaitForResult=TimeSpan.FromSeconds(15);