当前位置: 首页>>代码示例>>C#>>正文


C# Result.Dispose方法代码示例

本文整理汇总了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>";
//.........这里部分代码省略.........
开发者ID:hugovin,项目名称:shrimpisthefruitofthesea,代码行数:101,代码来源:dropdownlist.aspx.cs


注:本文中的Result.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。