本文整理匯總了C#中Mono.Data.Sqlite.SqliteDataReader.GetDataTypeName方法的典型用法代碼示例。如果您正苦於以下問題:C# SqliteDataReader.GetDataTypeName方法的具體用法?C# SqliteDataReader.GetDataTypeName怎麽用?C# SqliteDataReader.GetDataTypeName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mono.Data.Sqlite.SqliteDataReader
的用法示例。
在下文中一共展示了SqliteDataReader.GetDataTypeName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ReadAllRows
private void ReadAllRows (SqliteDataReader reader)
{
int ii, field_count = reader.FieldCount;
/* Metadata */
records_affected = reader.RecordsAffected;
decltypes = new string[field_count];
for (ii = 0; ii < field_count; ii++) {
decltypes[ii] = reader.GetDataTypeName (ii);
}
columns = new string[field_count];
for (ii = 0; ii < field_count; ii++) {
string column_name = reader.GetName (ii);
columns[ii] = column_name;
column_names[column_name] = ii;
column_names[column_name.ToUpper ()] = ii;
}
/* Read all rows, store in this->rows */
while (reader.Read ()) {
object[] data_row = new object[field_count];
for (ii = 0; ii < field_count; ii++) {
object value = reader.GetValue (ii);
if (Convert.IsDBNull (value))
value = null;
data_row[ii] = value;
}
rows.Add (data_row);
}
}
示例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;
}