本文整理汇总了C#中Mono.Data.Sqlite.SqliteDataReader.GetFloat方法的典型用法代码示例。如果您正苦于以下问题:C# SqliteDataReader.GetFloat方法的具体用法?C# SqliteDataReader.GetFloat怎么用?C# SqliteDataReader.GetFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Data.Sqlite.SqliteDataReader
的用法示例。
在下文中一共展示了SqliteDataReader.GetFloat方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMonsterData
static public MonsterData GetMonsterData(int id)
{
string query = "SELECT * FROM MONSTER where id = " + id;
reader = ExecuteQuery(query);
MonsterData monster = new MonsterData();
if (reader.Read())
{
monster.id = reader.GetInt32(0);
monster.name = reader.GetString(1);
monster.hp = reader.GetFloat(2);
monster.attack = reader.GetFloat(3);
monster.defence = reader.GetFloat(4);
monster.gold = reader.GetInt32(5);
}
reader.Dispose();
return monster;
}
示例2: DataReturn
/// <summary>
/// 返回一個資料串
/// </summary>
public string DataReturn(SqliteDataReader data)
{
string database = "";
for (int i = 0; i < data.FieldCount; i++) {
// 資料是否為空
switch (data.IsDBNull(i)) {
case true:
switch (data.GetDataTypeName(i)){
case "TEXT":
database += "" + ",";
break;
case "INTEGER":
database += "" + 0 + ",";
break;
case "REAL":
database += "" + 0 + ",";
break;
default:
Debug.LogError("類型缺失");
return database;
}
break;
case false:
switch (data.GetDataTypeName(i)) {
case "TEXT":
database += data.GetString(i) + ",";
break;
case "INTEGER":
database += "" + data.GetInt32(i) + ",";
break;
case "REAL":
database += "" + data.GetFloat(i) + ",";
break;
default:
Debug.LogError("類型缺失");
return database;
}
break;
}
}
return database;
}
示例3: GetUserDefineData
//.........这里部分代码省略.........
}
}
} else {
var temp = sql.Split(new String[]{"select"},StringSplitOptions.RemoveEmptyEntries);
var temp1 = temp [0];
var temp2 = temp1.Split (new String[]{"from"},StringSplitOptions.RemoveEmptyEntries);
var temp3 = temp2 [0].Split (',');
int leng_t3 = temp3.Length;
for (int c=0;c<leng_t3;c++){
tablehead [c] = temp3 [c];
}
}
}else{
//update of delete
if (sql.Contains ("update")) {
reader = ExecuteQuery (sql);
throw new Exception ("update affected "+reader.RecordsAffected+" rows");
} else if(sql.Contains("delete")){
reader = ExecuteQuery (sql);
throw new Exception ("delete affected "+ reader.RecordsAffected +" rows");
}else if (sql.Contains("insert")){
//insert
Exception e= null;
try{
ExecuteQuery(sql,false);
}catch(Exception e1){
e = e1;
throw e;
}finally{
if (e == null) {
throw new Exception ("insert success!");
}
}
}else if (sql.Contains("create")){
//create
Exception e = null;
try{
ExecuteQuery(sql,false);
}catch(Exception e2){
e = e2;
throw e;
}finally{
if (e == null) {
throw new Exception ("create new table success!");
}
}
}else if (sql.Contains("drop")){
Exception e = null;
try{
ExecuteQuery(sql,false);
}catch(Exception e3){
e = e3;
throw e;
}finally{
if(e == null){
throw new Exception ("drop table success!");
}
}
}
}
//get user self define data
getDbData = new Hashtable();
//table head
reader = ExecuteQuery (sql);
if (reader.HasRows){
int i = 0;
while(reader.Read()){
Hashtable temp = new Hashtable ();
for (int j =0;j<reader.FieldCount;j++){
Type t =reader.GetFieldType (j);
if(t == typeof(Int32)){
var val = reader.GetInt32 (j);
temp [j] = val;
}
if (t == typeof(Int64)) {
var val = reader.GetInt64 (j);
temp [j] = val;
}
if (t == typeof(Double)) {
var val = reader.GetFloat (j);
temp [j] = val;
}
if (t == typeof(String)) {
var val = reader.GetString (j);
temp [j] = val;
}
}
getDbData.Add (i, temp);
i++;
}
}
GameWorld.getInstance ().errorData.PushTextTable (tablehead);
return getDbData;
}
示例4: GetCountYearTypeData
public Hashtable GetCountYearTypeData(){
//get year type count
getDbData = new Hashtable();
string sql = "SELECT record_year,money_class,pay_type,sum(pay_value) from money_record WHERE uid = "+User.Instance().GetUid()+" GROUP BY record_year,money_class,pay_type ORDER BY record_year,money_class,pay_type";
//set table head
Hashtable tablehead = new Hashtable();
tablehead[0] = "year";
tablehead[1] = "money_class";
tablehead[2] = "pay_type";
tablehead[3] = "count_value";
GameWorld.getInstance().errorData.PushTextTable(tablehead);
reader = ExecuteQuery (sql);
if (reader.HasRows){
int i = 0;
while(reader.Read()){
Hashtable temp = new Hashtable ();
int year = reader.GetInt32 (0);
int money_class = reader.GetInt32 (1);
string money_class_str = GameWorld.getInstance().errorData.GetMoneyTypeStr(money_class);
int pay_type = reader.GetInt32 (2);
string pay_type_str = GameWorld.getInstance().errorData.GetPayTypeStr(pay_type);
float sum_pay = reader.GetFloat (3);
temp [0] = year;
temp [1] = money_class_str;
temp [2] = pay_type_str;
temp [3] = sum_pay;
getDbData.Add (i, temp);
i++;
}
}
return getDbData;
}
示例5: GetCurrentMoneyRecord
public Hashtable GetCurrentMoneyRecord(int uid){
//get current user money record
getDbData = new Hashtable();
string sql = "select id,record_year,record_month,record_day,money_class,pay_type,pay_value,msg,insert_time from money_record where uid = "+uid;
Hashtable tablehead = new Hashtable();
tablehead[0] = "seq";
tablehead[1] = "record_time";
tablehead[2] = "money_class";
tablehead[3] = "pay_type";
tablehead[4] = "pay_value";
tablehead[5] = "msg";
tablehead[6] = "datetime";
GameWorld.getInstance().errorData.PushTextTable(tablehead);
reader = ExecuteQuery (sql);
if (reader.HasRows) {
//has records
int i = 0;
while(reader.Read()){
int id = reader.GetInt32 (0);
int record_year = reader.GetInt32 (1);
int record_month = reader.GetInt32 (2);
int record_day = reader.GetInt32 (3);
int money_class = reader.GetInt32 (4);
string money_class_str = GameWorld.getInstance().errorData.GetMoneyTypeStr(money_class);
int pay_type = reader.GetInt32 (5);
string pay_type_str = GameWorld.getInstance().errorData.GetPayTypeStr(pay_type);
float pay_value = reader.GetFloat (6);
string msg = reader.GetString (7);
int insert_time = reader.GetInt32 (8);
string insert_time_str = Utils.GetTimeStr(insert_time).ToString();
string record_time = record_year + "/" + record_month + "/" + record_day;
Hashtable temp = new Hashtable();
temp[0] = id;
temp[1] = record_time;
temp[2] = money_class_str;
temp[3] = pay_type_str;
temp[4] = pay_value;
temp[5] = msg;
temp[6] = insert_time_str;
getDbData.Add(i, temp);
i++;
}
}
return getDbData;
}
示例6: GetItemData
static public ItemData GetItemData(int id)
{
string query = "SELECT * FROM ITEM where id = " + id;
reader = ExecuteQuery(query);
ItemData item = new ItemData();
if (reader.Read())
{
item.id = reader.GetInt32(0);
item.name = reader.GetString(1);
item.addHp = reader.GetFloat(2);
item.addAttack = reader.GetFloat(3);
item.addDefence = reader.GetFloat(4);
item.addGold = reader.GetInt32(5);
}
reader.Dispose();
return item;
}