• WCF 数据数据 DataTable


    一般在WCf数据大数据是 List集合 或者 Json。

         public DataTable GetProperitybyModelCode(string modelCode)
            {
                using (var entity = new USERRIGHTEntities())
                {
      //查询对应的表名和表的ID
    var queryResult = (from fx in entity.T_ModelInfo join tp in entity.T_ModelProperties on fx.F_ModelCode equals tp.F_ModelCode where fx.F_ModelCode == modelCode select new { TableName = tp.F_ProperieTable, ProperityCode = tp.F_ProperieCode }).FirstOrDefault();
    if (queryResult != null && queryResult.TableName != null) { var retVal = new DataTable(); var entityConn = (EntityConnection)entity.Connection; var sqlConn = (SqlConnection)entityConn.StoreConnection; var cmdReport = new SqlCommand(string.Format("select * from [{0}] where F_ProperieCode={1}", queryResult.TableName, queryResult.ProperityCode), sqlConn); var daReport = new SqlDataAdapter(cmdReport); using (cmdReport) { daReport.Fill(retVal); } retVal.TableName = queryResult.TableName;//这里一定要写个表名 不然在返回客户端的时候 会报个错。 return retVal; } } return null; }

    客户端调用:

      var client=new BpjdqOperatorServiceClient(SIMUBUSINESSLOGICDATA.WebServiceApp.WsHttpBinding(),SIMUBUSINESSLOGICDATA.WebServiceApp.BpjdqEndpoingAddress());
                client.BeginGetProperitybyModelCode("0001", delegate(IAsyncResult asyncResult)
                    {
                        var query = client.EndGetProperitybyModelCode(asyncResult);
                        if (query.Rows.Count>0)
                        {
                            foreach (var item in query.Rows)
                            {
                                
                            }
                        }
                 
                    }, null);

  • 相关阅读:
    常见面试题
    Spring boot 集成ckeditor
    SchuledExecutorService 使用controller控制线程关闭
    sql用法
    Spring Boot 全局异常配置
    前端错误提示whitelabel error page
    github使用方法
    前端迭代取出 后台map返回的数据
    Codeforces Beta Round #31 (Div. 2, Codeforces format)
    Codeforces Beta Round #29 (Div. 2, Codeforces format)
  • 原文地址:https://www.cnblogs.com/w2011/p/3343092.html
Copyright © 2020-2023  润新知