本文整理汇总了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]);
}
示例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;
}
}
示例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);
}