本文整理汇总了C#中SqlQuery.SetParameter方法的典型用法代码示例。如果您正苦于以下问题:C# SqlQuery.SetParameter方法的具体用法?C# SqlQuery.SetParameter怎么用?C# SqlQuery.SetParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlQuery
的用法示例。
在下文中一共展示了SqlQuery.SetParameter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: findUsersByNameAndProjection
public User[] findUsersByNameAndProjection()
{
SqlQuery<User> query = new SqlQuery<User>( "Name = ?"){Projections = new []{"Name"}};
query.SetParameter (1, "John Dow");
return proxy.ReadMultiple<User>(query);
}
示例2: sqlParameterFindUsersByNameAndCreditLimit
public User[] sqlParameterFindUsersByNameAndCreditLimit()
{
SqlQuery<User> query = new SqlQuery<User>("Name = ? AND CreditLimit > ?");
query.SetParameter(1, "John Dow");
query.SetParameter(2, 1000.00);
return proxy.ReadMultiple<User>(query);
}
示例3: findUsersByEnum
public User[] findUsersByEnum()
{
SqlQuery<User> query = new SqlQuery<User>( "Status = ?");
query.SetParameter(1, EAccountStatus.BLOCKED);
return proxy.ReadMultiple<User>(query);
}
示例4: readProductsBySQL
public SpaceDocument[] readProductsBySQL()
{
SqlQuery<SpaceDocument> query = new SqlQuery<SpaceDocument>("Product","Price > ?");
query.SetParameter(1, 15.0);
return proxy.ReadMultiple<SpaceDocument>(query);
}
示例5: queryExamples
public void queryExamples()
{
SpaceTypeDescriptorBuilder descriptorBuilder = new SpaceTypeDescriptorBuilder("WithCompoundIndex");
descriptorBuilder.AddFixedProperty("IntProp", typeof(int));
descriptorBuilder.AddFixedProperty("StringProp", typeof(String));
descriptorBuilder.AddFixedProperty("LongProp", typeof(long));
descriptorBuilder.AddCompoundIndex(new []{ "IntProp", "StringProp" });
descriptorBuilder.AddCompoundIndex(new []{ "LongProp", "StringProp" });
// Option 1 - Use the fluent setParameter(int index, Object value) method:
SqlQuery<Account> query1 = new SqlQuery<Account>("num > ? or num < ? and name = ?");
query1.SetParameter(1, 2);
query1.SetParameter(2, 3);
query1.SetParameter(3, "smith");
query1.Routing = 1;
// Option 2 - Use the setParameters(Object... parameters) method:
SqlQuery<Account> query2 = new SqlQuery<Account>("num > ? or num < ? and name = ?");
// query2.SetParameter(2, 3, "smith");
// Option 3: Use the constructor to pass the parameters:
//SqlQuery<Account> query3 = new SqlQuery<Account>("num > ? or num < ? and name = ?", 2, 3, "smith");
}
示例6: clearUserBySQL
public void clearUserBySQL()
{
SqlQuery<User> query = new SqlQuery<User>("Name = ?");
query.SetParameter(1, "John Dow");
proxy.Clear(query);
}
示例7: takeUserBySQL
public User takeUserBySQL()
{
SqlQuery<User> query = new SqlQuery<User>("Status = ?");
query.SetParameter(1, EAccountStatus.BLOCKED);
return proxy.Take<User>(query);
}
示例8: unprocessedData
SqlQuery<Payment> unprocessedData()
{
SqlQuery<Payment> template = new SqlQuery<Payment>( "status = ?");
template.SetParameter(1, ETransactionStatus.CANCELLED);
return template;
}