当前位置: 首页>>代码示例>>C#>>正文


C# SQLHelper.GetDataSet方法代码示例

本文整理汇总了C#中SQLHelper.GetDataSet方法的典型用法代码示例。如果您正苦于以下问题:C# SQLHelper.GetDataSet方法的具体用法?C# SQLHelper.GetDataSet怎么用?C# SQLHelper.GetDataSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLHelper的用法示例。


在下文中一共展示了SQLHelper.GetDataSet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Export

 public void Export(string tableName)
 {
     SQLHelper helper = new SQLHelper();
     DataSet ds1 = null;
     if (tableName == "User_Status")
     {
         string strSql = "select B.Alias as [User],c.Abbr as Segment,A.Status,Name as Rool from User_Status A,[User] B,Segment C,[Role]  "
                   + " where A.UserID=B.UserID and A.SegmentID=C.ID and B.Deleted=0 and C.Deleted=0 and B.RoleID=[Role].ID";
         ds1 = helper.GetDataSet(strSql);
     }
     else if (tableName == "TrafficLights")
     {
         string trafficLightSql = "  select Alias,Abbr, 'Status'= "
                           + " case "
                           + " when Status IS NULL and RoleID=2 then 'R' "
                           + " when Status IS null and RoleID=3 then 'Y' "
                           + " when Status IS null and RoleID=4 then 'R' "
                           + " when Status is not null then Status "
                           + " end ,Name as Role"
                           + " from "
                           + " (select A.UserID,A.SegmentID,B.Alias,C.Abbr,B.RoleID from User_Segment A inner join [User] B on A.UserID=B.UserID "
                           + " inner join Segment C on A.SegmentID=C.ID "
                           + " where B.RoleID in (2,3,4) and B.Deleted=0 and A.Deleted=0 and C.Deleted=0) O "
                           + " left join "
                           + " (select UserID,SegmentID,Status from User_Status "
                           + " union "
                           + " select MarketingMgrID as UserID,SegmentID,Status from ActualSalesandBL_Status) P "
                           + " on O.UserID=P.UserID and O.SegmentID=P.SegmentID "
                           + " inner join Role on RoleID=Role.ID";
         ds1 = helper.GetDataSet(trafficLightSql);
     }
     else
         ds1 = helper.GetDataSet("select * from [" + tableName + "]");
     if (ds1 == null)
     {
         return;
     }
     ds1.Tables[0].TableName = tableName;
     exportExcel(ds1.Tables[0]);
 }
开发者ID:gracianani,项目名称:SINO_CRM,代码行数:40,代码来源:AdminDownloadData.aspx.cs

示例2: getProject

 private DataSet getProject()
 {
     SQLHelper helper = new SQLHelper();
     StringBuilder sql = new StringBuilder();
     sql.AppendLine(" SELECT ");
     sql.AppendLine("   P.ID, ");
     sql.AppendLine("   P.Name+'('+C.ISO_Code+')' 'Project Name' ");
     sql.AppendLine(" FROM ");
     sql.AppendLine("   Project P LEFT JOIN Country C ON P.PoDID=C.ID ");
     sql.AppendLine(" WHERE ");
     sql.AppendLine("   P.Deleted=0 ");
     sql.AppendLine(" ORDER BY ");
     sql.AppendLine("   P.Name ");
     DataSet ds_project = helper.GetDataSet(sql.ToString());
     if (ds_project.Tables.Count > 0)
     {
         return ds_project;
     }
     else
     {
         return null;
     }
 }
开发者ID:gracianani,项目名称:SINO_CRM,代码行数:23,代码来源:ProjectSelect.aspx.cs

示例3: getProjectNameByName

 private DataSet getProjectNameByName(string proName)
 {
     SQLHelper helper = new SQLHelper();
     StringBuilder sql = new StringBuilder();
     sql.AppendLine(" SELECT ");
     sql.AppendLine("   P.ID, ");
     sql.AppendLine("   P.Name+'('+C.ISO_Code+')' 'Project Name' ");
     sql.AppendLine(" FROM ");
     sql.AppendLine("   Project P LEFT JOIN Country C ON P.PoDID=C.ID ");
     sql.AppendLine(" WHERE ");
     sql.AppendLine("    P.Name  LIKE @NAME ESCAPE '/' AND P.Deleted=0 ");
     SqlParameter[] sqlParams = { new SqlParameter("@NAME", "%" + proName.Replace("/", "//").Replace("%", "/%").Replace("_", "/_") + "%") };
     return helper.GetDataSet(sql.ToString() , CommandType.Text, sqlParams);
 }
开发者ID:gracianani,项目名称:SINO_CRM,代码行数:14,代码来源:ProjectSelect.aspx.cs


注:本文中的SQLHelper.GetDataSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。