本文整理汇总了C#中DBHelper.GetData方法的典型用法代码示例。如果您正苦于以下问题:C# DBHelper.GetData方法的具体用法?C# DBHelper.GetData怎么用?C# DBHelper.GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBHelper
的用法示例。
在下文中一共展示了DBHelper.GetData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HoborAsker
//const double AllowRange = 0.5;
public static HoborModel HoborAsker(DBHelper DBHelper, double XAxis, double YAxis)
{
HoborModel result=new HoborModel();
double AllowRange = GetConfig.GetAllowRange();
double xAxisAbove = XAxis + AllowRange
, xAxisBelow = XAxis - AllowRange
, yAxisAbove = YAxis + AllowRange
, yAxisBelow = YAxis - AllowRange;
string commandText = "SELECT * FROM Hobor WHERE XAxis BETWEEN @XAxis1 AND @XAxis2 AND YAxis Between @YXias1 AND @YXias2";
System.Data.DataTable dt = DBHelper.GetData(commandText, new List<Parameter>()
{
new Parameter("@XAxis1",xAxisBelow)
,new Parameter("@XAxis2",xAxisAbove)
,new Parameter("@YXias1",yAxisBelow)
,new Parameter("@YXias2", yAxisAbove)
});
if (dt != null && dt.Rows.Count > 0)
{
result.IsExist = true;
result.CountryName = dt.Rows[0]["CountryName"].ToString();
result.Name = dt.Rows[0]["Name"].ToString();
result.XAxis = Common.ConvertToDouble(dt.Rows[0]["XAxis"]);
result.YAxis = Common.ConvertToDouble(dt.Rows[0]["YAxis"]);
result.Info = dt.Rows[0]["Info"].ToString();
}
return result;
}
示例2: GetWorkbookDetails
//mafMasterMachine, mafGUID
public static List<WorkbookDetail> GetWorkbookDetails(string machineName, string sourceMAFGuid, out string strError)
{
var eAudITDBHelper = new DBHelper();
DataSet result = eAudITDBHelper.GetData(machineName, sourceMAFGuid, "GetWorkbookDetails", "");
if (result == null || result.Tables.Count == 0)
{
strError = string.Empty;
return null;
}
if (result.Tables[0].Columns.Contains("Error"))
{
strError = result.Tables[0].Rows[0]["Error"].ToString();
return null;
}
strError = string.Empty;
return result.Tables[0].AsEnumerable().Select(x => new WorkbookDetail { BusinessUnitID = x.Field<string>("BusinessUnitID"), WorkbookName = x.Field<string>("WorkbookName"), Workflow = x.Field<string>("Workflow") }).ToList();
}