本文整理汇总了C#中Result.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Result.Dispose方法的具体用法?C# Result.Dispose怎么用?C# Result.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Result
的用法示例。
在下文中一共展示了Result.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string SiteId = "1";
string ContId = "1";
if (Session["SiteId"] != null) {
SiteId = Session["SiteId"].ToString();
}
if(Session["ContId"] != null){
ContId=Session["ContId"].ToString();
}
itemInformation.Text = "";
if(Request["word"] != null){
//mean that if has a word for the request.
if(Request["word"]!=""){
//All good to go.
string findWord = Request["word"];
//Page vars
int PageSize = 5;
int PageNum = 1;
int FirstRow = PageNum * PageSize - PageSize;
int CurrentRow = 0;
//
Result resultTitle = new Result();
DataSet dsfinder = new DataSet();
System.Text.StringBuilder sb = new System.Text.StringBuilder();
//---
dsfinder.Clear();
//dsfinder = resultTitle.Find_TitlebyDesc(findWord,null,null,null,null,null);
// <New embed sql contrl>
try
{
DataBase = new SqlConnection(connectionString);
DataBase.Open();
DataSet datasetRes = new DataSet();
SqlCommand cmd = new SqlCommand();
cmd.Connection = DataBase;
cmd.CommandText = "Find_TitlebyDesc";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@SiteId", SqlDbType.Int);
cmd.Parameters.Add("@ContId ", SqlDbType.Int);
cmd.Parameters.Add("@TextFinder", SqlDbType.VarChar, 250);
//Setting values to Parameters.
cmd.Parameters[0].Value = SiteId;
cmd.Parameters[1].Value = ContId;
cmd.Parameters[2].Value = findWord;
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = cmd;
datasetRes.Clear();
adapter.Fill(datasetRes);
cmd.Dispose();
DataBase.Close();
dsfinder = datasetRes;
}
catch (SqlException oSqlExp)
{
//Console.WriteLine("" + oSqlExp.Message);
dsfinder = null;
}
catch (Exception oEx)
{
//Console.WriteLine("" + oEx.Message);
dsfinder = null;
}
// </New embed sql contrl>
itemInformation.Text = "";
itemInformation.Text += "<div class=\"boxSearchInt\">";
itemInformation.Text += " <div class=\"searchTopInt\">";
itemInformation.Text += " <div class=\"searchTopIntTitle\"><p>Products</p></div>";
itemInformation.Text += " </div>";
foreach (DataTable table in dsfinder.Tables)
{
int cant = table.Rows.Count;
if (cant > 0)
{
foreach (DataRow row in table.Rows)
{
string imageThumbnail = row["imagetn"].ToString();
string productId = row["titleid"].ToString();
string productTitle = row["title"].ToString();
string originalTitle = productTitle;
//string productDescription = row["titledesc"].ToString();
string pubName = row["pubname"].ToString();
string pubId = row["pubid"].ToString();
string sku = row["defaultSKU"].ToString();
if (productTitle.Length > 66)
{
productTitle = productTitle.Substring(0, 63) + "...";
}
/*if (productDescription.Length > 72)
{
productDescription = productDescription.Substring(0, 69) + "...";
}*/
itemInformation.Text += " <div class=\"searchMainInt\">";
itemInformation.Text += " <div class=\"searchProductInt\">";
itemInformation.Text += " <div class=\"searchImageDescrip\"><a href=\"product.aspx?p=" + productId + "\" onClick=\"document.getElementById('topSearch').value = '" + originalTitle + "'\"><img src=\"" + SiteConstants.imagesPathTb + "tn_" + imageThumbnail + "\" width=\"52\" height=\"65\"/></a></div>";
itemInformation.Text += " <div class=\"searchInfoDescrip\">";
itemInformation.Text += " <h2><a href=\"product.aspx?p=" + productId + "\" onClick=\"document.getElementById('topSearch').value = '" + originalTitle + "'\">" + productTitle + "</a></h2>";
//.........这里部分代码省略.........