在项目的开发中使用Remoting并且所有的数据请求服务都是通过Remoting完成的所以自然就在其中到了传递参数的存储过程在业务逻辑中把参数构建好后传递到Remoting服务端在取出存储过程的参数时报错具体错误不记得了自己尝试了各种方法也不行上网资讯也没有结果最后变通了一下问题解决了例子如下 以下部分为客户调用端 //先声明参数 private const string PARAM_GUID = @GUID; private const string PARAM_VGA_TREEGUID = @VGATreeGUID; private const string PARAM_MB_TREEGUID = @MBTreeGUID; public static string GetProductTypeByGUID(string GUID String VGATreeID String MbTreeID) { try { int lcID = ThreadCurrentThreadCurrentUICultureLCID; BaseModel bt = new BaseModel(); //构建一个哈希表把参数依次压入 Hashtable parames = new Hashtable(); paramesAdd(PARAM_PROGUID GUID); paramesAdd(PARAM_VGA_TREEGUID VGATreeID); paramesAdd(PARAM_MB_TREEGUID MbTreeID); //把存储过程名称和带参数的哈希表传入 DataAccessDataBaseRunProcedureDataSet(lcID GetProductTypeByTreeID parames ref bt); return btRows[][ProductType]ToString(); } catch (Exception ex) { CommFunctionWriteErrorLogFile(public static string GetProductTypeByGUID(stirng GUID String VGATreeID String MbTreeID)出错 + exMessage); return Other; } }
以下为服务端 public void Query(int lcid string SQLString Hashtable cmdHashtable ref BaseModel baseModel)#region public void Query(int lcid string SQLString Hashtable cmdHashtable ref BaseModel baseModel) // public void Query(int lcid string SQLString Hashtable cmdHashtable ref BaseModel baseModel) { if (!CheckRemotingClient()) { return; } ConsoleWriteLine(DateTimeNowToString() + 调用了Query( + lcidToString() + string SQLString Hashtable cmdHashtable ref BaseModel baseModel)); int i = cmdHashtableCount; //以下构造存储过程参数 SqlParameter[] cmdParms = new SqlParameter[i]; int j = ; foreach (DictionaryEntry de in cmdHashtable) { cmdParms[j] = new SqlParameter(deKeyToString() deValue); j++; } ColorfulDBUtilityDbHelperSQLQuery(lcid SQLString cmdParms ref baseModel); } // #endregion |