本文整理汇总了C#中System.Data.SQLite.SQLiteDataReader.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteDataReader.GetString方法的具体用法?C# SQLiteDataReader.GetString怎么用?C# SQLiteDataReader.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SQLite.SQLiteDataReader
的用法示例。
在下文中一共展示了SQLiteDataReader.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildUserStructure
private Person BuildUserStructure(SQLiteDataReader reader)
{
string name = reader.GetString(0);
string fullName = reader.GetString(1);
long personId = reader.GetInt64(2);
return new Person(name, fullName, personId);
}
示例2: ActivityExtractor
/* Returns a Activity using a SQLiteDataReader and a dictionary mapping the attributes to a index.
*/
private Activity ActivityExtractor(SQLiteDataReader reader, Dictionary<string, int> attributeIndexDict)
{
return new Activity(reader.GetInt32(attributeIndexDict["activityId"]),
reader.GetInt32(attributeIndexDict["seqNum"]), reader.GetString(attributeIndexDict["workoutName"]),
reader.GetInt32(attributeIndexDict["numSets"]), reader.GetInt32(attributeIndexDict["workoutVersion"]),
reader.GetString(attributeIndexDict["exerciseName"]), reader.GetInt32(attributeIndexDict["exerciseVersion"]));
}
示例3: BuildStructure
private Expense BuildStructure(SQLiteDataReader reader)
{
long expenseId = reader.GetInt64(0);
long accountId = reader.GetInt64(1);
long amount = reader.GetInt64(2);
long categoryId = reader.GetInt64(3);
DateTime date = DateTime.Parse(reader.GetString(4));
string description = reader.GetString(5);
return new Expense(expenseId, accountId, amount, categoryId, date, description);
}
示例4: ReadTranslationMemory
private TranslationMemory ReadTranslationMemory(SQLiteDataReader reader)
{
TranslationMemory tm = new TranslationMemory();
tm.tmid = reader.GetInt32(0); // tmid used for update
tm.japanese = GetSegmentFromXml(reader.GetString(4)); // source_segment
tm.chinese = GetSegmentFromXml(reader.GetString(6)); // target_segment
tm.tags += reader.GetString(8) + Environment.NewLine; // user
tm.tags += reader.GetString(9) + Environment.NewLine; // date
tm.tmname = Path.GetFileName(this.sourcePath);
return tm;
}
示例5: HydrateGuests
private Guest[] HydrateGuests(SQLiteDataReader reader) {
var guests = new List<Guest>();
while (reader.Read()) {
var guest = new Guest();
guest.Name = reader.GetString(1);
guest.ReservationDate = DateTime.Parse(reader.GetString(2));
guest.Attending = bool.Parse(reader.GetString(3));
guest.Underage = bool.Parse(reader.GetString(4));
guests.Add(guest);
}
return guests.ToArray();
}
示例6: printToConsole
public string printToConsole(SQLiteDataReader readerDB, int index)
{
if (readerDB.IsDBNull(index))
{
//return "NULL";
return "";
}
else
{
String dataObject = readerDB.GetFieldType(index).ToString();
switch (dataObject)
{
case "System.Int32":
return readerDB.GetInt32(index).ToString();
case "System.DateTime":
DateTime date = readerDB.GetDateTime(index);
return Convert.ToString(date);
case "System.String":
return readerDB.GetString(index);
default:
return "Unknown";
}
}
}
示例7: ReadDvbData
protected void ReadDvbData(SQLiteDataReader r, IDictionary<string, int> field, DataRoot dataRoot,
IDictionary<string, bool> encryptionInfo)
{
string longName, shortName;
this.GetChannelNames(r.GetString(field["channel_label"]), out longName, out shortName);
this.Name = longName;
this.ShortName = shortName;
this.RecordOrder = r.GetInt32(field["channel_order"]);
this.FreqInMhz = (decimal)r.GetInt32(field["frequency"]) / 1000;
int serviceType = r.GetInt32(field["dvb_service_type"]);
this.ServiceType = serviceType;
this.OriginalNetworkId = r.GetInt32(field["onid"]);
this.TransportStreamId = r.GetInt32(field["tsid"]);
this.ServiceId = r.GetInt32(field["sid"]);
int bits = r.GetInt32(field["list_bits"]);
this.Favorites = this.ParseFavorites(bits);
if ((this.SignalSource & SignalSource.Sat) != 0)
{
int satId = r.GetInt32(field["sat_id"]);
var sat = dataRoot.Satellites.TryGet(satId);
if (sat != null)
{
this.Satellite = sat.Name;
this.SatPosition = sat.OrbitalPosition;
int tpId = satId * 1000000 + (int)this.FreqInMhz;
var tp = dataRoot.Transponder.TryGet(tpId);
if (tp != null)
{
this.SymbolRate = tp.SymbolRate;
}
}
}
this.Encrypted = encryptionInfo.TryGet(this.Uid);
}
示例8: JsonRow
public JsonRow(SQLiteDataReader result)
{
rowData = new JObject();
for (int i = 0; i < result.FieldCount; i++)
{
string column = result.GetString(i);
rowData[column] = result[i].ToString();
}
}
示例9: MapDataReaderToContentDto
internal static void MapDataReaderToContentDto(SQLiteDataReader dataReader, out ContentDto contentDto)
{
contentDto = new ContentDto();
contentDto.ContentId = dataReader.GetInt64((int) ContentDao.ContentsField.ContentId);
contentDto.UrlId = dataReader.GetInt64((int) ContentDao.ContentsField.UrlId);
contentDto.ContentType = (ContentTypesEnum) dataReader.GetInt64((int) ContentDao.ContentsField.ContentType);
contentDto.Element = dataReader.GetString((int) ContentDao.ContentsField.Element);
contentDto.Element = HttpUtility.UrlDecode(contentDto.Element);
contentDto.Line = dataReader.GetInt64((int) ContentDao.ContentsField.Line);
contentDto.LinePosition = dataReader.GetInt64((int) ContentDao.ContentsField.LinePosition);
}
示例10: execute
public void execute(ref ObservableCollection<TagedItem> _TagedItemCollection)
{
sqliteCon.Open();
createCommand = new SQLiteCommand(query, sqliteCon);
createCommand.ExecuteNonQuery();
dataReader = createCommand.ExecuteReader();
_TagedItemCollection.Clear();
while (dataReader.Read())
{
_TagedItemCollection.Add(new TagedItem
{
FileName = dataReader.GetString(2),
FileExension = dataReader.GetString(3),
ModifyDate = dataReader.GetString(4)
});
}
sqliteCon.Close();
}
示例11: getLatestMsgFromUser
public string[] getLatestMsgFromUser(string uid)
{
this.clearCmd();
string username = this.getUsernameById(Convert.ToInt16(uid));
string[] msgAr = new string[3];
msgAr[0] = username;
cmd.CommandText="Select msg,sendTimestamp from msgLog where userid="+uid+" ORDER BY sendTimestamp DESC LIMIT 0,1";
reader=cmd.ExecuteReader();
reader.Read();
msgAr[1] = Convert.ToString(reader.GetDateTime(1));
msgAr[2] = reader.GetString(0);
return msgAr;
}
示例12: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
con = new SQLiteConnection("Data Source=e:\\db\\project.s3db");
con.Open();
SQLiteCommand command = new SQLiteCommand("Select * from train", con);
reader = command.ExecuteReader();
//SQLiteDataAdapter ad=new SQLiteDataAdapter(,con);
//GridView gv = new GridView();
String str = "<table><tr><th>train no</th><th>train name</th><th>train timing</th><th>avaliable tickets</th><th>total tickets</th><th>cost</th></tr>";
while (reader.Read())
{
str += "</tr><td>" + reader.GetValue(0) + "</td>";
str += "<td>" + reader.GetString(1) + "</td>";
str += "<td>" + reader.GetString(2) + "</td>";
str += "<td>" + reader.GetValue(3) + "</td>";
str += "<td>" + reader.GetValue(4) + "</td>";
str += "<td>" + reader.GetValue(5) + "</td></tr>";
}
str += "</table>";
traindiv.InnerHtml = str;
con.Close();
}
示例13: CountRecords
//TODO: Doesn't accept single quote
//TODO: improve focus lost checking
//TODO: Consider making the database with unique index key!! so you can delete an item based on table selection/ or
//TODO: change the delete method to accept string from the grid.
//TODO: Make delete button dissapear when nothing is selected/ or make it read delete parameter from the grid.
//TODO: Make append/change function.
//TODO: Test github new master branch
public void CountRecords()
{
string command = "SELECT * FROM PasterData";
sqlite_connection.Open();
SQLiteCommand sqlite_command = sqlite_connection.CreateCommand();
sqlite_command.CommandText = command;
sqlite_datareader = sqlite_command.ExecuteReader();
while (sqlite_datareader.Read()) // Read() returns true if there is still a result line to read
{
string myreader = sqlite_datareader.GetString(0);
if (_maxNumber < Convert.ToInt32(myreader))
{
_maxNumber = Convert.ToInt32(myreader);
}
_count++;
}
}
示例14: ReadDateTime
public static object ReadDateTime(SQLiteDataReader reader, int idx)
{
try
{
if (!reader.IsDBNull(idx))
{
string val = reader.GetString(idx);
if(val.Length != 0)
{
return DateTime.Parse(val);
}
}
return new DateTime(1970, 1, 1);
}
catch (Exception)
{
return new DateTime(1970, 1, 1);
}
}
示例15: ReadHeader
void ReadHeader()
{
SQLiteCommand command = _connection.CreateCommand();
command.CommandText = "SELECT key, value FROM header;";
_reader = command.ExecuteReader();
while (_reader.Read())
{
var key = _reader.GetString(0);
var value = _reader.GetValue(1);
if (key.ToLower() == "clientbuild")
{
int build;
if (int.TryParse(value.ToString(), out build))
SetBuild(build);
break;
}
}
_reader.Close();
}