本文整理汇总了C#中DataBase.ExecuteDataset方法的典型用法代码示例。如果您正苦于以下问题:C# DataBase.ExecuteDataset方法的具体用法?C# DataBase.ExecuteDataset怎么用?C# DataBase.ExecuteDataset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase.ExecuteDataset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadLog
public void ReadLog(DataBase db)
{
if ((this.Id == null) || (this.Id.Trim() == ""))
{
throw new LogException("没有选择日志ID");
}
string commandText = "select id,webuser,type,nrstring,logip,nrstringdata,logtable,logtablekey,logtableid,logdelyy,webusername,logdate,name from " + GetAccessType.DataBaseName + "v_qx_log where id='" + this.Id + "'";
try
{
DataSet set = db.ExecuteDataset(commandText);
if ((set != null) && (set.Tables[0].Rows.Count > 0))
{
this.Id = set.Tables[0].Rows[0]["id"].ToString();
this.UserId = Convert.IsDBNull(set.Tables[0].Rows[0]["webuser"]) ? "" : set.Tables[0].Rows[0]["webuser"].ToString();
this.UserName = Convert.IsDBNull(set.Tables[0].Rows[0]["webusername"]) ? "" : set.Tables[0].Rows[0]["webusername"].ToString();
this.FunctionId = Convert.IsDBNull(set.Tables[0].Rows[0]["type"]) ? "" : set.Tables[0].Rows[0]["type"].ToString();
this.FunctionName = Convert.IsDBNull(set.Tables[0].Rows[0]["name"]) ? "" : set.Tables[0].Rows[0]["name"].ToString();
this.LogIp = Convert.IsDBNull(set.Tables[0].Rows[0]["logip"]) ? "" : set.Tables[0].Rows[0]["logip"].ToString();
this.functiondata = Convert.IsDBNull(set.Tables[0].Rows[0]["nrstringdata"]) ? null : ((byte[]) set.Tables[0].Rows[0]["nrstringdata"]);
this.LogTable = Convert.IsDBNull(set.Tables[0].Rows[0]["logtable"]) ? "" : set.Tables[0].Rows[0]["logtable"].ToString();
this.LogTableKey = Convert.IsDBNull(set.Tables[0].Rows[0]["logtablekey"]) ? "" : set.Tables[0].Rows[0]["logtablekey"].ToString();
this.LogTableId = Convert.IsDBNull(set.Tables[0].Rows[0]["logtableid"]) ? "" : set.Tables[0].Rows[0]["logtableid"].ToString();
this.LogCause = Convert.IsDBNull(set.Tables[0].Rows[0]["logdelyy"]) ? "" : set.Tables[0].Rows[0]["logdelyy"].ToString();
this.LogDate = Convert.IsDBNull(set.Tables[0].Rows[0]["logdate"]) ? "" : set.Tables[0].Rows[0]["logdate"].ToString();
}
}
catch (LogException)
{
throw new LogException("读取日志失败!");
}
}
示例2: SearchLog
public static QxLog[] SearchLog(string strwhere, DataBase db)
{
QxLog[] logArray = null;
string commandText = "select id,webuser,type,nrstring,logip,nrstringdata,logtable,logtablekey,logtableid,logdelyy,webusername,logdate,name from " + GetAccessType.DataBaseName + "v_qx_log";
if ((strwhere != null) && (strwhere.Trim() != ""))
{
commandText = commandText + " where " + strwhere;
}
try
{
DataSet set = db.ExecuteDataset(commandText);
if (set == null)
{
return logArray;
}
logArray = new QxLog[set.Tables[0].Rows.Count];
for (int i = 0; i < set.Tables[0].Rows.Count; i++)
{
logArray[i] = new QxLog();
logArray[i].Id = set.Tables[0].Rows[0]["id"].ToString();
logArray[i].UserId = Convert.IsDBNull(set.Tables[0].Rows[0]["webuser"]) ? "" : set.Tables[0].Rows[0]["webuser"].ToString();
logArray[i].UserName = Convert.IsDBNull(set.Tables[0].Rows[0]["webusername"]) ? "" : set.Tables[0].Rows[0]["webusername"].ToString();
logArray[i].FunctionId = Convert.IsDBNull(set.Tables[0].Rows[0]["type"]) ? "" : set.Tables[0].Rows[0]["type"].ToString();
logArray[i].FunctionName = Convert.IsDBNull(set.Tables[0].Rows[0]["name"]) ? "" : set.Tables[0].Rows[0]["name"].ToString();
logArray[i].LogIp = Convert.IsDBNull(set.Tables[0].Rows[0]["logip"]) ? "" : set.Tables[0].Rows[0]["logip"].ToString();
logArray[i].functiondata = Convert.IsDBNull(set.Tables[0].Rows[0]["nrstringdata"]) ? null : ((byte[]) set.Tables[0].Rows[0]["nrstringdata"]);
logArray[i].LogTable = Convert.IsDBNull(set.Tables[0].Rows[0]["logtable"]) ? "" : set.Tables[0].Rows[0]["logtable"].ToString();
logArray[i].LogTableKey = Convert.IsDBNull(set.Tables[0].Rows[0]["logtablekey"]) ? "" : set.Tables[0].Rows[0]["logtablekey"].ToString();
logArray[i].LogTableId = Convert.IsDBNull(set.Tables[0].Rows[0]["logtableid"]) ? "" : set.Tables[0].Rows[0]["logtableid"].ToString();
logArray[i].LogCause = Convert.IsDBNull(set.Tables[0].Rows[0]["logdelyy"]) ? "" : set.Tables[0].Rows[0]["logdelyy"].ToString();
logArray[i].LogDate = Convert.IsDBNull(set.Tables[0].Rows[0]["logdate"]) ? "" : set.Tables[0].Rows[0]["logdate"].ToString();
}
}
catch (LogException)
{
throw new LogException("读取日志失败!");
}
return logArray;
}