本文整理汇总了C#中Microsoft.Data.Sqlite.SqliteParameter类的典型用法代码示例。如果您正苦于以下问题:C# SqliteParameter类的具体用法?C# SqliteParameter怎么用?C# SqliteParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqliteParameter类属于Microsoft.Data.Sqlite命名空间,在下文中一共展示了SqliteParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例4: AddWithValue
public virtual SqliteParameter AddWithValue(string parameterName, object value)
{
var parameter = new SqliteParameter(parameterName, value);
Add(parameter);
return parameter;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}