本文整理匯總了C#中MySql.Data.MySqlClient.MySqlCommand.GetValue方法的典型用法代碼示例。如果您正苦於以下問題:C# MySqlCommand.GetValue方法的具體用法?C# MySqlCommand.GetValue怎麽用?C# MySqlCommand.GetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MySql.Data.MySqlClient.MySqlCommand
的用法示例。
在下文中一共展示了MySqlCommand.GetValue方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Select
public static Dictionary<string, object>[] Select(string table, string where, string order, string limit, string fields)
{
if (!String.IsNullOrWhiteSpace(where))
{
where = " WHERE " + where;
}
if (!String.IsNullOrWhiteSpace(order))
{
order = " ORDER BY " + order;
}
if (!String.IsNullOrWhiteSpace(limit))
{
limit = " LIMIT " + limit;
}
string sql = "SELECT " + fields + " FROM `" + table + "`" + where + order + limit;
lock (mySqlReaderLock)
{
using (MySqlDataReader resultSet = new MySqlCommand(sql, DefaultConnection()).ExecuteReader())
{
List<Dictionary<string, object>> rtn = new List<Dictionary<string, object>>();
while (resultSet.Read())
{
Dictionary<string, object> row = new Dictionary<string, object>();
for (int j = 0; j < resultSet.FieldCount; j++)
{
row[resultSet.GetName(j)] = resultSet.GetValue(j);
}
rtn.Add(row);
}
return rtn.ToArray();
}
}
}