投票系统分享(7)
来源:未知 责任编辑:责任编辑 发表时间:2015-03-01 01:47 点击:次
27 </td>
28 </tr>
29 <tr>
30 </tr>
31 <tr>
32 <td colspan="2" rowspan="1" style="height: 13px">
33 <asp:Button ID="Button1" runat="server" Text="投票" Width="78px" OnClick="Button1_Click" />
34
35 <asp:Button ID="Button2" runat="server" Text="查看" Width="72px" OnClick="Button2_Click" /></td>
36 </tr>
37 </table>
38
39 </div>
40 </form>
41 </body>
42 </html>
第二个页面代码:
1 using System;
2 using System.Data;
3 using System.Configuration;
4 using System.Collections;
5 using System.Web;
6 using System.Web.Security;
7 using System.Web.UI;
8 using System.Web.UI.WebControls;
9 using System.Web.UI.WebControls.WebParts;
10 using System.Web.UI.HtmlControls;
11 using System.Data.SqlClient;
12
13 public partial class LookVote : System.Web.UI.Page
14 {
15 protected void Page_Load(object sender, EventArgs e)
16 {
17 SqlConnection con = new SqlConnection();
18 con.ConnectionString = " Data Source=.;database=VoteDB;integrated security=true; ";
19 string sql = "select a.Title,a.SumNumber,a.Mode,a.Status,b.*,case a.SumNumber when 0 then 0 else round(cast(b.Number as float)/cast(a.SumNumber as float)*100,2) end as ItemPercent from VoteTitle a,VoteItem b where a.TitleID=b.TitleID and a.Status=1";
20 SqlDataAdapter sda = new SqlDataAdapter(sql, con);
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>