本文整理汇总了C#中Microsoft.Data.Sqlite.SqliteParameter类的典型用法代码示例。如果您正苦于以下问题:C# SqliteParameter类的具体用法?C# SqliteParameter怎么用?C# SqliteParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqliteParameter类属于Microsoft.Data.Sqlite命名空间,在下文中一共展示了SqliteParameter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Update
public bool Update(
Guid guid,
Guid siteGuid,
string folderName)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("UPDATE mp_SiteFolders ");
sqlCommand.Append("SET ");
sqlCommand.Append("SiteGuid = :SiteGuid, ");
sqlCommand.Append("FolderName = :FolderName ");
sqlCommand.Append("WHERE ");
sqlCommand.Append("Guid = :Guid ;");
SqliteParameter[] arParams = new SqliteParameter[3];
arParams[0] = new SqliteParameter(":Guid", DbType.String);
arParams[0].Value = guid.ToString();
arParams[1] = new SqliteParameter(":SiteGuid", DbType.String);
arParams[1].Value = siteGuid.ToString();
arParams[2] = new SqliteParameter(":FolderName", DbType.String);
arParams[2].Value = folderName;
int rowsAffected = AdoHelper.ExecuteNonQuery(
connectionString,
sqlCommand.ToString(),
arParams);
return (rowsAffected > -1);
}
开发者ID:freemsly,项目名称:cloudscribe,代码行数:34,代码来源:DBSiteFolder.cs
示例2: Ctor_sets_name_and_value
public void Ctor_sets_name_and_value()
{
var result = new SqliteParameter("@Parameter", 1);
Assert.Equal("@Parameter", result.ParameterName);
Assert.Equal(1, result.Value);
}
开发者ID:RonFrick,项目名称:Microsoft.Data.Sqlite,代码行数:7,代码来源:SqliteParameterTest.cs
示例3: GetUserCountByYearMonth
public DbDataReader GetUserCountByYearMonth(int siteId)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("SELECT ");
sqlCommand.Append("strftime('%Y', DateCreated) AS Y, ");
sqlCommand.Append("strftime('%m', DateCreated) AS M, ");
sqlCommand.Append("strftime('%Y', DateCreated) + '-' + strftime('%m', DateCreated) AS Label, ");
sqlCommand.Append("COUNT(*) As Users ");
sqlCommand.Append("FROM ");
sqlCommand.Append("mp_Users ");
sqlCommand.Append("WHERE ");
sqlCommand.Append("SiteID = :SiteID ");
sqlCommand.Append("GROUP BY strftime('%Y', DateCreated), strftime('%m', DateCreated) ");
sqlCommand.Append("ORDER BY strftime('%Y', DateCreated), strftime('%m', DateCreated) ");
sqlCommand.Append("; ");
SqliteParameter[] arParams = new SqliteParameter[1];
arParams[0] = new SqliteParameter(":SiteID", DbType.Int32);
arParams[0].Value = siteId;
return AdoHelper.ExecuteReader(
connectionString,
sqlCommand.ToString(),
arParams);
}
开发者ID:ludev,项目名称:cloudscribe,代码行数:27,代码来源:DBSiteUser.cs
示例4: AddWithValue
public virtual SqliteParameter AddWithValue(string parameterName, object value)
{
var parameter = new SqliteParameter(parameterName, value);
Add(parameter);
return parameter;
}
开发者ID:leloulight,项目名称:Microsoft.Data.Sqlite,代码行数:7,代码来源:SqliteParameterCollection.cs
示例5: Add
public bool Add(
Guid guid,
Guid siteGuid,
string folderName)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("INSERT INTO mp_SiteFolders (");
sqlCommand.Append("Guid, ");
sqlCommand.Append("SiteGuid, ");
sqlCommand.Append("FolderName )");
sqlCommand.Append(" VALUES (");
sqlCommand.Append(":Guid, ");
sqlCommand.Append(":SiteGuid, ");
sqlCommand.Append(":FolderName );");
SqliteParameter[] arParams = new SqliteParameter[3];
arParams[0] = new SqliteParameter(":Guid", DbType.String);
arParams[0].Value = guid.ToString();
arParams[1] = new SqliteParameter(":SiteGuid", DbType.String);
arParams[1].Value = siteGuid.ToString();
arParams[2] = new SqliteParameter(":FolderName", DbType.String);
arParams[2].Value = folderName;
int rowsAffected = AdoHelper.ExecuteNonQuery(
connectionString,
sqlCommand.ToString(),
arParams);
return rowsAffected > 0;
}
开发者ID:freemsly,项目名称:cloudscribe,代码行数:35,代码来源:DBSiteFolder.cs
示例6: GetSiteSettingsExList
public DbDataReader GetSiteSettingsExList(int siteId)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("SELECT e.* ");
sqlCommand.Append("FROM mp_SiteSettingsEx e ");
sqlCommand.Append("JOIN ");
sqlCommand.Append("mp_SiteSettingsExDef d ");
sqlCommand.Append("ON ");
sqlCommand.Append("e.KeyName = d.KeyName ");
sqlCommand.Append("AND e.GroupName = d.GroupName ");
sqlCommand.Append("WHERE ");
sqlCommand.Append("e.SiteID = :SiteID ");
sqlCommand.Append("ORDER BY d.GroupName, d.SortOrder ");
sqlCommand.Append(";");
SqliteParameter[] arParams = new SqliteParameter[1];
arParams[0] = new SqliteParameter(":SiteID", DbType.Int32);
arParams[0].Value = siteId;
return AdoHelper.ExecuteReader(
connectionString,
sqlCommand.ToString(),
arParams);
}
开发者ID:wintorojati,项目名称:cloudscribe,代码行数:30,代码来源:DBSiteSettingsEx.cs
示例7: Ctor_sets_other_values
public void Ctor_sets_other_values()
{
var result = new SqliteParameter("@Parameter", SqliteType.Integer, 8, "Column");
Assert.Equal("@Parameter", result.ParameterName);
Assert.Equal(SqliteType.Integer, result.SqliteType);
Assert.Equal(8, result.Size);
Assert.Equal("Column", result.SourceColumn);
}
开发者ID:RonFrick,项目名称:Microsoft.Data.Sqlite,代码行数:9,代码来源:SqliteParameterTest.cs
示例8: ResetDbType_works
public void ResetDbType_works()
{
var parameter = new SqliteParameter
{
DbType = DbType.Int64,
SqliteType = SqliteType.Integer
};
parameter.ResetDbType();
Assert.Equal(DbType.String, parameter.DbType);
Assert.Equal(SqliteType.Text, parameter.SqliteType);
}
开发者ID:RonFrick,项目名称:Microsoft.Data.Sqlite,代码行数:13,代码来源:SqliteParameterTest.cs
示例9: Create
public bool Create(
int siteId,
string loginProvider,
string providerKey,
string providerDisplayName,
string userId)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("INSERT INTO mp_UserLogins (");
sqlCommand.Append("LoginProvider ,");
sqlCommand.Append("ProviderKey, ");
sqlCommand.Append("UserId, ");
sqlCommand.Append("SiteId, ");
sqlCommand.Append("ProviderDisplayName ");
sqlCommand.Append(") ");
sqlCommand.Append("VALUES (");
sqlCommand.Append(":LoginProvider, ");
sqlCommand.Append(":ProviderKey, ");
sqlCommand.Append(":UserId, ");
sqlCommand.Append(":SiteId, ");
sqlCommand.Append(":ProviderDisplayName ");
sqlCommand.Append(")");
sqlCommand.Append(";");
SqliteParameter[] arParams = new SqliteParameter[5];
arParams[0] = new SqliteParameter(":LoginProvider", DbType.String);
arParams[0].Value = loginProvider;
arParams[1] = new SqliteParameter(":ProviderKey", DbType.String);
arParams[1].Value = providerKey;
arParams[2] = new SqliteParameter(":UserId", DbType.String);
arParams[2].Value = userId;
arParams[3] = new SqliteParameter(":SiteId", DbType.Int32);
arParams[3].Value = siteId;
arParams[4] = new SqliteParameter(":ProviderDisplayName", DbType.String);
arParams[4].Value = providerDisplayName;
int rowsAffected = AdoHelper.ExecuteNonQuery(
connectionString,
sqlCommand.ToString(),
arParams);
return (rowsAffected > -1);
}
开发者ID:wintorojati,项目名称:cloudscribe,代码行数:51,代码来源:DBUserLogins.cs
示例10: GetUserList
public DbDataReader GetUserList(int siteId)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("SELECT UserID, Name, PasswordSalt, Pwd, Email FROM mp_Users WHERE SiteID = :SiteID ORDER BY Email");
SqliteParameter[] arParams = new SqliteParameter[1];
arParams[0] = new SqliteParameter(":SiteID", DbType.Int32);
arParams[0].Value = siteId;
return AdoHelper.ExecuteReader(
connectionString,
sqlCommand.ToString(),
arParams);
}
开发者ID:ludev,项目名称:cloudscribe,代码行数:16,代码来源:DBSiteUser.cs
示例11: RoleCreate
public int RoleCreate(
Guid roleGuid,
Guid siteGuid,
int siteId,
string roleName)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("INSERT INTO mp_Roles (");
sqlCommand.Append("SiteID, ");
sqlCommand.Append("RoleName, ");
sqlCommand.Append("DisplayName, ");
sqlCommand.Append("SiteGuid, ");
sqlCommand.Append("RoleGuid )");
sqlCommand.Append(" VALUES (");
sqlCommand.Append(":SiteID, ");
sqlCommand.Append(":RoleName, ");
sqlCommand.Append(":RoleName, ");
sqlCommand.Append(":SiteGuid, ");
sqlCommand.Append(":RoleGuid )");
sqlCommand.Append(";");
sqlCommand.Append("SELECT LAST_INSERT_ROWID();");
SqliteParameter[] arParams = new SqliteParameter[4];
arParams[0] = new SqliteParameter(":SiteID", DbType.Int32);
arParams[0].Value = siteId;
arParams[1] = new SqliteParameter(":RoleName", DbType.String);
arParams[1].Value = roleName;
arParams[2] = new SqliteParameter(":SiteGuid", DbType.String);
arParams[2].Value = siteGuid.ToString();
arParams[3] = new SqliteParameter(":RoleGuid", DbType.String);
arParams[3].Value = roleGuid.ToString();
int newID = Convert.ToInt32(AdoHelper.ExecuteScalar(
connectionString,
sqlCommand.ToString(),
arParams).ToString());
return newID;
}
开发者ID:freemsly,项目名称:cloudscribe,代码行数:46,代码来源:DBRoles.cs
示例12: Create
public int Create(
int siteId,
string userId,
string claimType,
string claimValue)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("INSERT INTO mp_UserClaims (");
sqlCommand.Append("SiteId, ");
sqlCommand.Append("UserId, ");
sqlCommand.Append("ClaimType, ");
sqlCommand.Append("ClaimValue )");
sqlCommand.Append(" VALUES (");
sqlCommand.Append(":SiteId, ");
sqlCommand.Append(":UserId, ");
sqlCommand.Append(":ClaimType, ");
sqlCommand.Append(":ClaimValue )");
sqlCommand.Append(";");
sqlCommand.Append("SELECT LAST_INSERT_ROWID();");
SqliteParameter[] arParams = new SqliteParameter[4];
arParams[0] = new SqliteParameter(":UserId", DbType.String);
arParams[0].Value = userId;
arParams[1] = new SqliteParameter(":ClaimType", DbType.Object);
arParams[1].Value = claimType;
arParams[2] = new SqliteParameter(":ClaimValue", DbType.Object);
arParams[2].Value = claimValue;
arParams[3] = new SqliteParameter(":SiteId", DbType.Int32);
arParams[3].Value = siteId;
int newID = Convert.ToInt32(AdoHelper.ExecuteScalar(
connectionString,
sqlCommand.ToString(),
arParams).ToString());
return newID;
}
开发者ID:ludev,项目名称:cloudscribe,代码行数:44,代码来源:DBUserClaims.cs
示例13: Create
/// <summary>
/// Inserts a row in the mp_GeoCountry table. Returns rows affected count.
/// </summary>
/// <param name="guid"> guid </param>
/// <param name="name"> name </param>
/// <param name="iSOCode2"> iSOCode2 </param>
/// <param name="iSOCode3"> iSOCode3 </param>
/// <returns>bool</returns>
public bool Create(
Guid guid,
string name,
string iSOCode2,
string iSOCode3)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("INSERT INTO mp_GeoCountry (");
sqlCommand.Append("Guid, ");
sqlCommand.Append("Name, ");
sqlCommand.Append("ISOCode2, ");
sqlCommand.Append("ISOCode3 )");
sqlCommand.Append(" VALUES (");
sqlCommand.Append(":Guid, ");
sqlCommand.Append(":Name, ");
sqlCommand.Append(":ISOCode2, ");
sqlCommand.Append(":ISOCode3 )");
sqlCommand.Append(";");
SqliteParameter[] arParams = new SqliteParameter[4];
arParams[0] = new SqliteParameter(":Guid", DbType.String);
arParams[0].Value = guid.ToString();
arParams[1] = new SqliteParameter(":Name", DbType.String);
arParams[1].Value = name;
arParams[2] = new SqliteParameter(":ISOCode2", DbType.String);
arParams[2].Value = iSOCode2;
arParams[3] = new SqliteParameter(":ISOCode3", DbType.String);
arParams[3].Value = iSOCode3;
int rowsAffected = AdoHelper.ExecuteNonQuery(
connectionString,
sqlCommand.ToString(),
arParams);
return rowsAffected > 0;
}
开发者ID:freemsly,项目名称:cloudscribe,代码行数:51,代码来源:DBGeoCountry.cs
示例14: Create
/// <summary>
/// Inserts a row in the mp_Language table. Returns rows affected count.
/// </summary>
/// <param name="guid"> guid </param>
/// <param name="name"> name </param>
/// <param name="code"> code </param>
/// <param name="sort"> sort </param>
/// <returns>bool</returns>
public bool Create(
Guid guid,
string name,
string code,
int sort)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("INSERT INTO mp_Language (");
sqlCommand.Append("Guid, ");
sqlCommand.Append("Name, ");
sqlCommand.Append("Code, ");
sqlCommand.Append("Sort )");
sqlCommand.Append(" VALUES (");
sqlCommand.Append(":Guid, ");
sqlCommand.Append(":Name, ");
sqlCommand.Append(":Code, ");
sqlCommand.Append(":Sort )");
sqlCommand.Append(";");
SqliteParameter[] arParams = new SqliteParameter[4];
arParams[0] = new SqliteParameter(":Guid", DbType.String);
arParams[0].Value = guid.ToString();
arParams[1] = new SqliteParameter(":Name", DbType.String);
arParams[1].Value = name;
arParams[2] = new SqliteParameter(":Code", DbType.String);
arParams[2].Value = code;
arParams[3] = new SqliteParameter(":Sort", DbType.Int32);
arParams[3].Value = sort;
int rowsAffected = AdoHelper.ExecuteNonQuery(
connectionString,
sqlCommand.ToString(),
arParams);
return rowsAffected > 0;
}
开发者ID:freemsly,项目名称:cloudscribe,代码行数:50,代码来源:DBLanguage.cs
示例15: GetPageListForAdmin
public DbDataReader GetPageListForAdmin(int siteId)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("SELECT ");
sqlCommand.Append("PageID, ");
sqlCommand.Append("ParentID, ");
sqlCommand.Append("PageOrder, ");
sqlCommand.Append("PageName ");
sqlCommand.Append("FROM mp_Pages ");
sqlCommand.Append("WHERE SiteID = :SiteID ");
sqlCommand.Append("ORDER BY ParentID, PageName ;");
SqliteParameter[] arParams = new SqliteParameter[1];
arParams[0] = new SqliteParameter(":SiteID", DbType.Int32);
arParams[0].Value = siteId;
return AdoHelper.ExecuteReader(
connectionString,
sqlCommand.ToString(),
arParams);
}
开发者ID:joeaudette,项目名称:cloudscribe.Core.Data,代码行数:24,代码来源:DBSiteSettings.cs
示例16: GetSite
public DbDataReader GetSite(string hostName)
{
StringBuilder sqlCommand = new StringBuilder();
SqliteParameter[] arParams = new SqliteParameter[1];
arParams[0] = new SqliteParameter(":HostName", DbType.String);
arParams[0].Value = hostName;
int siteId = -1;
sqlCommand.Append("SELECT mp_SiteHosts.SiteID As SiteID ");
sqlCommand.Append("FROM mp_SiteHosts ");
sqlCommand.Append("WHERE mp_SiteHosts.HostName = :HostName ;");
using (DbDataReader reader = AdoHelper.ExecuteReader(
connectionString,
sqlCommand.ToString(),
arParams))
{
if (reader.Read())
{
siteId = Convert.ToInt32(reader["SiteID"]);
}
}
sqlCommand = new StringBuilder();
sqlCommand.Append("SELECT * ");
sqlCommand.Append("FROM mp_Sites ");
sqlCommand.Append("WHERE SiteID = :SiteID OR :SiteID = -1 ");
sqlCommand.Append("ORDER BY SiteID ");
sqlCommand.Append("LIMIT 1 ;");
arParams = new SqliteParameter[1];
arParams[0] = new SqliteParameter(":SiteID", DbType.Int32);
arParams[0].Value = siteId;
return AdoHelper.ExecuteReader(
connectionString,
sqlCommand.ToString(),
arParams);
}
开发者ID:joeaudette,项目名称:cloudscribe.Core.Data,代码行数:42,代码来源:DBSiteSettings.cs
示例17: DeleteHostsBySite
public bool DeleteHostsBySite(int siteId)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("DELETE FROM mp_SiteHosts ");
sqlCommand.Append("WHERE SiteID = :SiteID ; ");
SqliteParameter[] arParams = new SqliteParameter[1];
arParams[0] = new SqliteParameter(":SiteID", DbType.Int32);
arParams[0].Value = siteId;
int rowsAffected = AdoHelper.ExecuteNonQuery(
connectionString,
sqlCommand.ToString(),
arParams);
return rowsAffected > 0;
}
开发者ID:joeaudette,项目名称:cloudscribe.Core.Data,代码行数:18,代码来源:DBSiteSettings.cs
示例18: AddHost
public bool AddHost(Guid siteGuid, int siteId, string hostName)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("INSERT INTO mp_SiteHosts ");
sqlCommand.Append("( ");
sqlCommand.Append("SiteID, ");
sqlCommand.Append("SiteGuid, ");
sqlCommand.Append("HostName ");
sqlCommand.Append(") ");
sqlCommand.Append("VALUES ");
sqlCommand.Append("( ");
sqlCommand.Append(":SiteID, ");
sqlCommand.Append(":SiteGuid, ");
sqlCommand.Append(":HostName ");
sqlCommand.Append(") ;");
SqliteParameter[] arParams = new SqliteParameter[3];
arParams[0] = new SqliteParameter(":SiteID", DbType.Int32);
arParams[0].Value = siteId;
arParams[1] = new SqliteParameter(":HostName", DbType.String);
arParams[1].Value = hostName;
arParams[2] = new SqliteParameter(":SiteGuid", DbType.String);
arParams[2].Value = siteGuid.ToString();
int rowsAffected = AdoHelper.ExecuteNonQuery(
connectionString,
sqlCommand.ToString(),
arParams);
return rowsAffected > 0;
}
开发者ID:joeaudette,项目名称:cloudscribe.Core.Data,代码行数:36,代码来源:DBSiteSettings.cs
示例19: GetHost
public DbDataReader GetHost(string hostName)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("SELECT * ");
sqlCommand.Append("FROM mp_SiteHosts ");
sqlCommand.Append("WHERE HostName = :HostName ;");
SqliteParameter[] arParams = new SqliteParameter[1];
arParams[0] = new SqliteParameter(":HostName", DbType.String);
arParams[0].Value = hostName;
return AdoHelper.ExecuteReader(
connectionString,
sqlCommand.ToString(),
arParams);
}
开发者ID:joeaudette,项目名称:cloudscribe.Core.Data,代码行数:18,代码来源:DBSiteSettings.cs
示例20: Delete
public bool Delete(int siteId)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("DELETE FROM mp_UserProperties WHERE UserGuid IN (SELECT UserGuid FROM mp_Users WHERE SiteID = :SiteID);");
sqlCommand.Append("DELETE FROM mp_UserRoles WHERE UserID IN (SELECT UserID FROM mp_Users WHERE SiteID = :SiteID);");
sqlCommand.Append("DELETE FROM mp_UserLocation WHERE UserGuid IN (SELECT UserGuid FROM mp_Users WHERE SiteID = :SiteID);");
sqlCommand.Append("DELETE FROM mp_Users WHERE SiteID = :SiteID; ");
sqlCommand.Append("DELETE FROM mp_Roles WHERE SiteID = :SiteID; ");
sqlCommand.Append("DELETE FROM mp_SiteHosts WHERE SiteID = :SiteID; ");
sqlCommand.Append("DELETE FROM mp_SiteFolders WHERE SiteGuid IN (SELECT SiteGuid FROM mp_Sites WHERE SiteID = :SiteID);");
sqlCommand.Append("DELETE FROM mp_SiteSettingsEx WHERE SiteID = :SiteID; ");
sqlCommand.Append("DELETE FROM mp_RedirectList WHERE SiteGuid IN (SELECT SiteGuid FROM mp_Sites WHERE SiteID = :SiteID);");
sqlCommand.Append("DELETE FROM mp_TaskQueue WHERE SiteGuid IN (SELECT SiteGuid FROM mp_Sites WHERE SiteID = :SiteID);");
sqlCommand.Append("DELETE FROM mp_Sites ");
sqlCommand.Append("WHERE HostID = :SiteID ; ");
SqliteParameter[] arParams = new SqliteParameter[1];
arParams[0] = new SqliteParameter(":SiteID", DbType.Int32);
arParams[0].Value = siteId;
int rowsAffected = AdoHelper.ExecuteNonQuery(
connectionString,
sqlCommand.ToString(),
arParams);
return (rowsAffected > 0);
}
开发者ID:joeaudette,项目名称:cloudscribe.Core.Data,代码行数:38,代码来源:DBSiteSettings.cs
注:本文中的Microsoft.Data.Sqlite.SqliteParameter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论