zoukankan      html  css  js  c++  java
  • SubSonic直接执行SQL语句

    SubSonic直接执行SQL语句可以使用以下方式:

    	public void Inline_Simple()
    	{
    		QueryCommand cmd = new InlineQuery().GetCommand("SELECT productID from products");
    		Assert.IsTrue(cmd.CommandSql == 
                    "SELECT productID from products");
    	}
     
    	public void Inline_WithCommands()
    	{
    		QueryCommand cmd = new InlineQuery()
                   .GetCommand(@"SELECT productID from products 
                       WHERE productid=@productid", 1);
     
    		Assert.IsTrue(cmd.Parameters[0].ParameterName == "@productid");
    		Assert.IsTrue((int)cmd.Parameters[0].ParameterValue == 1);
    	}
     
    	public void Inline_AsCollection()
    	{
    		ProductCollection products =
    			new InlineQuery()
    				.ExecuteAsCollection<ProductCollection>(
                              @"SELECT productID from products 
                               WHERE productid=@productid", 1);
    	}

    注意:可能需要指定DataProvider,在应用中可能需要session的支持。

  • 相关阅读:
    JavaScript操作DOM对象
    QTP(13)
    QTP(12)
    QTP(11)
    QTP(10)
    QTP(9)
    QTP(8)
    QTP(7)
    QTP(6)
    QTP(5)
  • 原文地址:https://www.cnblogs.com/davinci/p/1714767.html
Copyright © 2011-2022 走看看