本文整理汇总了C#中System.Data.OleDb.OleDbDataReader.GetBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# OleDbDataReader.GetBoolean方法的具体用法?C# OleDbDataReader.GetBoolean怎么用?C# OleDbDataReader.GetBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.OleDb.OleDbDataReader
的用法示例。
在下文中一共展示了OleDbDataReader.GetBoolean方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Login
// Constructor for searched login
public Login(uint gloid)
{
// Declarations
uint gvoid = 0, modifiedby = 0;
string username = null, password = null, note = null, status = null;
bool active = false;
DateTime datemodified = new DateTime(1901, 1, 1);
// Command
string query = string.Format("SELECT glo_username, glo_password, glo_note, glo_active, glo_status, gvo_id, date_modified, modified_by FROM gfrc_login" +
" WHERE glo_id = {0}", gloid);
try
{
using (conn)
{
conn.Open();
cmd = new OleDbCommand(query, conn);
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
username = rdr.GetString(0);
password = rdr.GetString(1);
note = rdr.GetString(2);
active = rdr.GetBoolean(3);
status = rdr.GetString(4);
if (!UInt32.TryParse(rdr.GetValue(5).ToString(), out gvoid))
gvoid = 0;
if (!DateTime.TryParse(rdr.GetValue(6).ToString(), out datemodified))
datemodified = new DateTime(1901, 1, 1);
if (!UInt32.TryParse(rdr.GetValue(7).ToString(), out modifiedby))
modifiedby = 0;
}
}
}
finally
{
if (rdr != null)
rdr.Close();
}
if (conn != null)
{
conn.Close();
}
_gloID = gloid;
_Username = username;
_Password = password;
_Note = note;
_Active = active;
_Status = status;
_gvoID = gvoid;
_DateModified = datemodified;
_ModifiedBy = modifiedby;
}
示例2: Load
public static void Load(this DataObject dataObj, OleDbDataReader reader)
{
try
{
foreach (ColumnDefinition columnDef in dataObj.ColumnDefs())
{
if (reader.GetValue(columnDef.ColumnIndex) != DBNull.Value)
{
switch (columnDef.ColumnFieldType)
{
case ColumnDefinition.FieldType.String:
dataObj.GetColumnValues()[columnDef.ColumnIndex] = reader.GetString(columnDef.ColumnIndex);
break;
case ColumnDefinition.FieldType.Int32:
dataObj.GetColumnValues()[columnDef.ColumnIndex] = reader.GetInt32(columnDef.ColumnIndex);
break;
case ColumnDefinition.FieldType.Boolean:
dataObj.GetColumnValues()[columnDef.ColumnIndex] = reader.GetBoolean(columnDef.ColumnIndex);
break;
}
}
else //default values for nulls
{
switch (columnDef.ColumnFieldType)
{
case ColumnDefinition.FieldType.String:
dataObj.GetColumnValues()[columnDef.ColumnIndex] = string.Empty;
break;
case ColumnDefinition.FieldType.Int32:
dataObj.GetColumnValues()[columnDef.ColumnIndex] = 0;
break;
case ColumnDefinition.FieldType.Boolean:
dataObj.GetColumnValues()[columnDef.ColumnIndex] = false;
break;
}
}
}
}
catch (Exception e)
{
//TODO: what to do here?
}
}
示例3: Availability
// Constructor for searched volunteer
public Availability(uint gvoid)
{
// Declarations
uint gvaid = 0, reqhours = 0, modifiedby = 0;
bool mon = false, tues = false, wed = false, thur = false, fri = false, fillin = false;
DateTime datemodified = new DateTime(1901, 1, 1), start = new DateTime(1901, 1, 1), end = new DateTime(1901, 1, 1);
// Command
string query = string.Format("SELECT gva_id, gva_start, gva_end, gva_req_hours, gva_mon, gva_tues, gva_wed, gva_thur, gva_fri, gva_fill_in, date_modified, modified_by " +
"FROM gfrc_volunteer_avail WHERE gvo_id = {0}", gvoid);
try
{
using (conn)
{
conn.Open();
cmd = new OleDbCommand(query, conn);
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
UInt32.TryParse(rdr.GetValue(0).ToString(), out gvaid);
start = rdr.GetDateTime(1);
if (!DateTime.TryParse(rdr.GetValue(2).ToString(), out end))
end = new DateTime(1901, 1, 1);
UInt32.TryParse(rdr.GetValue(3).ToString(), out reqhours);
mon = rdr.GetBoolean(4);
tues = rdr.GetBoolean(5);
wed = rdr.GetBoolean(6);
thur = rdr.GetBoolean(7);
fri = rdr.GetBoolean(8);
fillin = rdr.GetBoolean(9);
if (!DateTime.TryParse(rdr.GetValue(10).ToString(), out datemodified))
datemodified = new DateTime(1901, 1, 1);
if (!UInt32.TryParse(rdr.GetValue(11).ToString(), out modifiedby))
modifiedby = 0;
}
}
}
finally
{
if (rdr != null)
rdr.Close();
}
if (conn != null)
{
conn.Close();
}
_gvaID = gvaid;
_gvoID = gvoid;
_Start = start;
_End = end;
_ReqHours = reqhours;
_Mon = mon;
_Tues = tues;
_Wed = wed;
_Thur = thur;
_Fri = fri;
_FillIn = fillin;
_DateModified = datemodified;
_ModifiedBy = modifiedby;
}
示例4: Volunteer
// Constructor for searched volunteer
public Volunteer(uint gvoid)
{
// Declarations
uint modifiedby = 0;
string name = null, address = null, postal = null, email = null, home = null, mobile = null;
string status = null, referred = null, refdoc = null, poldoc = null, application = null;
bool police = false, induction = false;
DateTime datemodified = new DateTime(1901, 1, 1), dob = new DateTime(1901, 1, 1);
// Command
string query = string.Format("SELECT gvo_name, gvo_address, gvo_postal_address, gvo_email, gvo_home_ph, gvo_mobile_ph, gvo_dob, gvo_status, gvo_referred, gvo_referred_doc, " +
"gvo_police, gvo_police_doc, gvo_induction, gvo_application, date_modified, modified_by FROM gfrc_volunteer" +
" WHERE (gvo_id = {0})", gvoid);
try
{
using (conn)
{
conn.Open();
cmd = new OleDbCommand(query, conn);
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
name = rdr.GetString(0);
address = rdr.GetString(1);
postal = rdr.GetString(2);
email = rdr.GetString(3);
home = rdr.GetString(4);
mobile = rdr.GetString(5);
dob = rdr.GetDateTime(6);
status = rdr.GetString(7);
referred = rdr.GetString(8);
refdoc = rdr.GetString(9);
police = rdr.GetBoolean(10);
poldoc = rdr.GetString(11);
induction = rdr.GetBoolean(12);
application = rdr.GetString(13);
if (!DateTime.TryParse(rdr.GetValue(14).ToString(), out datemodified))
datemodified = new DateTime(1901, 1, 1);
if (!UInt32.TryParse(rdr.GetValue(15).ToString(), out modifiedby))
modifiedby = 0;
}
}
}
catch (Exception e)
{
name = "";
address = "";
postal = "";
email = "";
home = "";
mobile = "";
dob = new DateTime(1901, 1, 1);
status = "";
referred = "";
refdoc = "";
police = false;
poldoc = "";
induction = false;
application = "";
datemodified = new DateTime(1901, 1, 1);
modifiedby = 0;
}
finally
{
if (rdr != null)
rdr.Close();
}
if (conn != null)
{
conn.Close();
}
_gvoID = gvoid;
_Name = name;
_Address = address;
_PostalAddress = postal;
_Email = email;
_HomePh = home;
_MobilePh = mobile;
_DOB = dob;
_Status = status;
_Referred = referred;
_ReferredDoc = refdoc;
_Police = police;
_PoliceDoc = poldoc;
_Induction = induction;
_Application = application;
_DateModified = datemodified;
_ModifiedBy = modifiedby;
}