本文整理汇总了C#中Mono.Data.Sqlite.SqliteDataReader.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# SqliteDataReader.GetValue方法的具体用法?C# SqliteDataReader.GetValue怎么用?C# SqliteDataReader.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Data.Sqlite.SqliteDataReader
的用法示例。
在下文中一共展示了SqliteDataReader.GetValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadFullTable
public ArrayList ReadFullTable(string tableName)
{
string query = "SELECT * FROM " + tableName;
databaseCommand = databaseConnection.CreateCommand();
databaseCommand.CommandText = query;
reader = databaseCommand.ExecuteReader();
ArrayList readArray = new ArrayList();
while (reader.Read())
{
ArrayList lineArray = new ArrayList();
for (int i = 0; i < reader.FieldCount; i++)
{
lineArray.Add(reader.GetValue(i));
}
readArray.Add(lineArray);
}
return readArray;
}
示例2: GetUserFromReader
/// <summary>
/// A helper function that takes the current row from the SqliteDataReader
/// and hydrates a MembershipUser from the values. Called by the
/// MembershipUser.GetUser implementation.
/// </summary>
/// <param name="reader">SqliteDataReader object</param>
/// <returns>MembershipUser object</returns>
MembershipUser GetUserFromReader(SqliteDataReader reader)
{
object providerUserKey = reader.GetValue(0);
string username = reader.GetString(1);
string email = string.Empty;
if (!reader.IsDBNull(2))
email = reader.GetString(2);
string passwordQuestion = string.Empty;
if (!reader.IsDBNull(3))
passwordQuestion = reader.GetString(3);
string comment = string.Empty;
if (!reader.IsDBNull(4))
comment = reader.GetString(4);
bool isApproved = reader.GetBoolean(5);
bool isLockedOut = reader.GetBoolean(6);
DateTime creationDate = reader.GetDateTime(7);
DateTime lastLoginDate = new DateTime();
if (!reader.IsDBNull(8))
lastLoginDate = reader.GetDateTime(8);
DateTime lastActivityDate = reader.GetDateTime(9);
DateTime lastPasswordChangedDate = reader.GetDateTime(10);
DateTime lastLockedOutDate = new DateTime();
if (!reader.IsDBNull(11))
lastLockedOutDate = reader.GetDateTime(11);
MembershipUser u = new MembershipUser(this.Name,
username,
providerUserKey,
email,
passwordQuestion,
comment,
isApproved,
isLockedOut,
creationDate,
lastLoginDate,
lastActivityDate,
lastPasswordChangedDate,
lastLockedOutDate);
return u;
}
示例3: GetUserFromReader
//
// GetUserFromReader
// A helper function that takes the current row from the SQLiteDataReader
// and hydrates a MembershipUser from the values. Called by the
// MembershipUser.GetUser implementation.
//
private MembershipUser GetUserFromReader(SqliteDataReader reader)
{
if (reader.GetString(1)=="") return null;
object providerUserKey=null;
string strGooid=Guid.NewGuid().ToString();
if (reader.GetValue(0).ToString().Length > 0)
providerUserKey = new Guid(reader.GetValue(0).ToString());
else
providerUserKey = new Guid(strGooid);
string username = reader.GetString(1);
string email = reader.GetString(2);
string passwordQuestion = "";
if (reader.GetValue(3) != DBNull.Value)
passwordQuestion = reader.GetString(3);
string comment = "";
if (reader.GetValue(4) != DBNull.Value)
comment = reader.GetString(4);
bool tmpApproved = (reader.GetValue(5) == null);
bool isApproved=false;
if(tmpApproved)
isApproved = reader.GetBoolean(5);
bool tmpLockedOut = (reader.GetValue(6) == null);
bool isLockedOut = false;
if(tmpLockedOut)
isLockedOut = reader.GetBoolean(6);
DateTime creationDate = DateTime.Now;
try
{
if (reader.GetValue(6) != DBNull.Value)
creationDate = reader.GetDateTime(7);
}
catch { }
DateTime lastLoginDate = DateTime.Now;
try
{
if (reader.GetValue(8) != DBNull.Value)
lastLoginDate = reader.GetDateTime(8);
}
catch { }
DateTime lastActivityDate = DateTime.Now;
try
{
if (reader.GetValue(9) != DBNull.Value)
lastActivityDate = reader.GetDateTime(9);
}
catch { }
DateTime lastPasswordChangedDate = DateTime.Now;
try
{
if (reader.GetValue(10) != DBNull.Value)
lastPasswordChangedDate = reader.GetDateTime(10);
}
catch { }
DateTime lastLockedOutDate = DateTime.Now;
try
{
if (reader.GetValue(11) != DBNull.Value)
lastLockedOutDate = reader.GetDateTime(11);
}
catch { }
MembershipUser u = new MembershipUser(this.Name,
username,
providerUserKey,
email,
passwordQuestion,
comment,
isApproved,
isLockedOut,
creationDate,
lastLoginDate,
lastActivityDate,
lastPasswordChangedDate,
lastLockedOutDate);
return u;
}
示例4: 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);
}
}
示例5: Deserialize
public void Deserialize(SqliteDataReader reader)
{
this.FullName = reader.GetString (0) as String;
this.FileName = reader.GetString (1) as String;
this.LineNumber = reader.GetInt32 (2);
this.ItemType = (ParserItemType)reader.GetInt32 (3);
var docValue = reader.GetValue (4);
if (docValue.GetType () == typeof (String))
this.Documentation = (string)docValue;
var extraValue = reader.GetValue (5);
if (extraValue.GetType () == typeof (string))
this.Extra = (string)extraValue;
}
示例6: ExecuteQuery
/// <summary>
/// Executes the query.
/// </summary>
/// <returns>The query.</returns>
/// <param name="query">Query.</param>
public DataTable ExecuteQuery(string query)
{
if (!canQuery) {
HDebug.LogWarning ("Can't execute the query, verify DB origin file");
return null;
}
if (!isConnectionOpen) {
Open (pathDB);
}
#if !UNITY_WEBPLAYER
if ((ConnectionState)dbconn.State != ConnectionState.Open) {
HDebug.LogWarning ("Sqlite DB is not open");
return null;
}
dbcmd.CommandText = query;
try {
reader = dbcmd.ExecuteReader ();
} catch (Exception e) {
HDebug.Log ("Query : " + query);
HDebug.LogError (e.Message);
return null;
}
#endif
DataTable dataTable = new DataTable ();
#if !UNITY_WEBPLAYER
for (int i = 0; i < reader.FieldCount; i++) {
dataTable.Columns.Add (reader.GetName (i));
}
while (reader.Read ()) {
DataRow row = new DataRow ();
for (int i = 0; i < reader.FieldCount; i++) {
row.Add (reader.GetName (i), reader.GetValue (i));
}
dataTable.Rows.Add (row);
}
#endif
if (!isConnectionOpen) {
Close ();
}
return dataTable;
}
示例7: SelectData
public void SelectData()
{
_query = "Select * From continar where name='PEPE'";//continar?
_command = _conexion.CreateCommand ();
_command.CommandText = _query;
_reader = _command.ExecuteReader ();
if(_reader != null){
while(_reader.Read()){
PlayerPrefs.SetString("Scene",_reader.GetValue(1).ToString());
PlayerPrefs.SetFloat("positionX",float.Parse(_reader.GetValue(2).ToString()));
PlayerPrefs.SetFloat("positionY",float.Parse(_reader.GetValue(3).ToString()));
}
}
}
示例8: SelectMonsterTable
//pasa todos los monstruos de la bd a playerprefs
public void SelectMonsterTable()
{
_query = "Select * From tablaMonstruos where owner='PEPE'";
_command = _conexion.CreateCommand ();
_command.CommandText = _query;
_reader = _command.ExecuteReader ();
Monstruo temp;
if(_reader != null){
while(_reader.Read()){
temp = Monstruo.CreateMonster(_reader.GetValue(1).ToString(),_reader.GetValue(0).ToString(),int.Parse(_reader.GetValue(2).ToString()),new Stats(_reader.GetValue(3).ToString()),new Estado(_reader.GetValue(4).ToString()));
SaveMonster.AddMonster(temp,false);
}
}
}
示例9: ConvertDataReaderToDataSet
public DataSet ConvertDataReaderToDataSet(SqliteDataReader reader, string[] sColNames)
{
DataSet dataSet = new DataSet();
try
{
// DataTable schemaTable = reader.GetSchemaTable();
DataTable dataTable = new DataTable();
for (int i = 0; i < sColNames.Length; i++)
{
string columnName = sColNames[i];
DataColumn column = new DataColumn(columnName);
dataTable.Columns.Add(column);
}
//for (int i = 0; i <= schemaTable.Rows.Count - 1; i++)
//{
// DataRow dataRow = schemaTable.Rows[i];
// string columnName = dataRow["ColumnName"].ToString();DataColumn column = new DataColumn(columnName, dataRow["DataType"].GetType());
// dataTable.Columns.Add(column);
//}
dataSet.Tables.Add(dataTable);
int j = 0;
while (reader.Read())
{
DataRow dataRow = dataTable.NewRow();
for (int i = 0; i < sColNames.Length; i++)
{
dataRow[i] = reader.GetValue(i);
}
j++;
dataTable.Rows.Add(dataRow);
}
reader.Dispose();
}
catch (Exception ex)
{
string sMsg = ex.Message.ToString();
}
return dataSet;
}