本文整理汇总了C#中System.Utils.ExecuteScalar方法的典型用法代码示例。如果您正苦于以下问题:C# Utils.ExecuteScalar方法的具体用法?C# Utils.ExecuteScalar怎么用?C# Utils.ExecuteScalar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Utils
的用法示例。
在下文中一共展示了Utils.ExecuteScalar方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: initDatabase
private void initDatabase(Utils.DBCon dbcon)
{
object o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='preset'");
if (o == null || o.GetType() == typeof(DBNull))
{
dbcon.ExecuteNonQuery("create table 'preset' (name text)");
}
o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='forms'");
if (o == null || o.GetType() == typeof(DBNull))
{
dbcon.ExecuteNonQuery("create table 'forms' (preset text, plugintype text, x integer, y integer, w integer, h integer, visible integer, customtag text)");
}
else if (!dbcon.ColumnExists("forms", "customtag"))
{
dbcon.ExecuteNonQuery("alter table 'forms' add customtag text");
}
}
示例2: initDatabase
private void initDatabase(Utils.DBCon dbcon)
{
object o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='processedpq'");
if (o == null || o.GetType() == typeof(DBNull))
{
dbcon.ExecuteNonQuery("create table 'processedpq' (pqname text, processdate text)");
}
}
示例3: initDatabase
private void initDatabase(Utils.DBCon dbcon)
{
object o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='shortcut'");
if (o == null || o.GetType() == typeof(DBNull))
{
dbcon.ExecuteNonQuery("create table 'shortcut' (plugintype text, action text, subaction text, keys integer, keystring text)");
}
}
示例4: InitDatabase
public bool InitDatabase(Utils.DBCon dbcon)
{
/*
* database:
* areainfo -> id, parentid, level, name, minlat, minlon, maxlat, maxlon
* poly -> id, areainfoid, position, lat, lon
*/
bool result = false;
try
{
object o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='areainfo'");
if (o == null || o.GetType() == typeof(DBNull))
{
dbcon.ExecuteNonQuery("create table 'areainfo' (id integer, parentid integer, level integer, name text, minlat real, minlon real, maxlat real, maxlon real)");
}
o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='poly'");
if (o == null || o.GetType() == typeof(DBNull))
{
dbcon.ExecuteNonQuery("create table 'poly' (id integer, areainfoid integer, position integer, lat real, lon real)");
dbcon.ExecuteNonQuery("create index idx_poly on poly (areainfoid)");
}
result = true;
}
catch
{
}
return result;
}
示例5: initDatabase
private void initDatabase(Utils.DBCon dbcon)
{
object o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='groups'");
if (o == null || o.GetType() == typeof(DBNull))
{
dbcon.ExecuteNonQuery("create table 'groups' (id integer, name text)");
}
o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='images'");
if (o == null || o.GetType() == typeof(DBNull))
{
dbcon.ExecuteNonQuery("create table 'images' (url text, imagedata blob)");
}
o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='trackables'");
if (o == null || o.GetType() == typeof(DBNull))
{
dbcon.ExecuteNonQuery("create table 'trackables' (groupid integer, AllowedToBeCollected integer, Archived integer, BugTypeID integer, Code text, CurrentGeocacheCode text, CurrentGoal text, DateCreated text, Description text, IconUrl text, Id integer, InCollection integer, Name text, TBTypeName text, Url text, WptTypeID integer, Owner text, HopCount integer, DiscoverCount integer, InCacheCount integer, DistanceKm real, Lat real, Lon real)");
dbcon.ExecuteNonQuery("create index idx_trackablesgroup on trackables (groupid)");
dbcon.ExecuteNonQuery("create index idx_trackablescode on trackables (code)");
}
o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='travels'");
if (o == null || o.GetType() == typeof(DBNull))
{
dbcon.ExecuteNonQuery("create table 'travels' (pos integer, TrackableCode text, GeocacheCode text, lat real, lon real, DateLogged text)");
dbcon.ExecuteNonQuery("create index idx_travels on travels (TrackableCode)");
}
o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='logs'");
if (o == null || o.GetType() == typeof(DBNull))
{
dbcon.ExecuteNonQuery("create table 'logs' (TrackableCode text, ID integer, LogCode text, GeocacheCode text, IsArchived integer, LoggedBy text, LogGuid text, LogIsEncoded integer, LogText text, WptLogTypeId integer, Url text, UTCCreateDate text, VisitDate text)");
dbcon.ExecuteNonQuery("create index idx_logstb on logs (TrackableCode)");
dbcon.ExecuteNonQuery("create index idx_logsid on logs (ID)");
}
}