熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

鮮花預定系統:主頁面[5]

2022-06-13   來源: .NET編程 
    ——此文章摘自《ASPNET +SQL Server網絡應用系統開發案例精解》定價 特價 詳細>>http://tracklinktechcn/?m_id=dangdang&a_id=A&l=&l_type= width= height= border= nosave>

             //返回DataView對象
             return ST_myDsTables[]DefaultView ;
    }
    ST_GetFlowerByHits()方法返回一個SqlDataReader可以通過SqlDataReader來遍歷整個數據集
    public SqlDataReader ST_GetFlowerByHits()
    {
             string ST_strsql;
             SqlDataReader ST_result;
             try
             {
                       //創建SqlConnection對象
                       SqlConnection ST_myCn=new SqlConnection(ST_strConn);
                       //創建查詢推薦前的鮮花名字的sql語句
                       ST_strsql=select top ST_idST_nameST_descr=&nbsp;&nbsp; +SUBSTRING (ST_description )+ST_image=case when(not ST_Cover is null) then <img src=ST_ReadFlowerCoveraspx? id=+cast(ST_id as varchar())+ Border= width= height=> else <img src=img/picjpg border= width = height=> end from ST_Flower order by ST_hits DESC;
                       //創建SqlCommand對象
                       SqlCommand ST_myCm=new SqlCommand(ST_strsqlST_myCn);
                       //打開連接
                       ST_myCnOpen ();
                       ST_result=ST_myCmExecuteReader(CommandBehaviorCloseConnection);
                       return ST_result;
             }
             catch(SystemDataSqlClientSqlException er)
             {
                       throw new Exception(erMessage);
             }
    }
    ST_GetCommentTop()用來查詢評論排名前的評論標題
    public DataView ST_GetCommentTop()
    {
             string ST_strsql;
             DataSet ST_myDs;
             //創建查詢評論排名前的評論標題的sql語句
             ST_strsql=select top ST_Flowerid ST_CommentCaption=ST_UserName+:+SUBSTRING(ST_ Caption ) from ST_Comment ;
             ST_myDs=ST_ExecuteSqlDs(ST_strsql);
             return ST_myDsTables[]DefaultView ;
    }

right>[http://developcsaicn/dotnet_ASP/htm>]  [http://developcsaicn/dotnet_ASP/htm>]  [http://developcsaicn/dotnet_ASP/htm>]  [http://developcsaicn/dotnet_ASP/htm>]  []  


From:http://tw.wingwit.com/Article/program/net/201311/15754.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.