现在关键是不知道里面的算法是怎么进行的
如果是ajax做的更好。java,c#都可以
如果是ajax做的更好。java,c#都可以
解决方案 »
- 很久以前看过一帖,用.net3.5做的一个winform程序,可以动态修改另外一个窗体的属性,如颜色字体等,谁知道那个连接(在线等)
- 访问access问题,求助
- DataGridView与BindingSource
- 怎么在运行期间创建自定义的web控件?
- 在windows程序中如何操控asp页面等
- .Net2002的CrystalReportView控件在.Net2003中出错.
- 用什么函数查到CHAR的ASCII编码????????????
- 程序员四年之人生感触,不散分(上)
- very easy small question:c#导入excel的问题。
- 请问,我如果把oicq的客户端集成到我的程序里面有没有侵权啊?
- 一简单酸法修改
- 今天用 Socket 碰到一个奇怪的问题...
就是 投票按钮事件,没单击一次,数据库中的票数加1.
就是一条Sql语句: 更新语句 update 表 set Count=count+1 where ItemID=投票项目ID
if exists (select 1
from sysobjects
where id = object_id('Vote')
and type = 'U')
drop table Vote
go/*==============================================================*/
/* Table: Vote */
/*==============================================================*/
create table Vote (
VoteID int identity(1,1),
UserID int not null,
WebSiteID int not null,
VoteName nvarchar(100) not null,
VoteDescription nvarchar(800) null,
StartDate datetime null,
EndDate datetime null,
Visible bit null,
Item1 nvarchar(50) not null,
Item2 nvarchar(50) null,
Item3 nvarchar(50) null,
Item4 nvarchar(50) null,
Item5 nvarchar(50) null,
Item6 nvarchar(50) null,
Item7 nvarchar(50) null,
Item8 nvarchar(50) null,
Number1 int not null,
Number2 int null,
Number3 int null,
Number4 int null,
Number5 int null,
Number6 int null,
Number7 int null,
Number8 int null,
constraint PK_VOTE primary key (VoteID)
)
goItem(n)是选项的文字
Number(n)是选项的票数
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="你平常使用什么语言进行开发"></asp:Label><br />
<br />
<asp:Label ID="Label2" runat="server" Text="java"></asp:Label>
<asp:Label ID="lblOne" Text="<%#getPercent(vote1) %>" runat="server"></asp:Label>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="投 票" /><br />
<br />
<asp:Label ID="Label3" runat="server" Text="c#"></asp:Label>
<asp:Label ID="lblTwo" Text="<%#getPercent(vote2) %>" runat="server"></asp:Label>
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="投 票" /><br />
<br />
<asp:Label ID="Label4" runat="server" Text="c++"></asp:Label>
<asp:Label ID="lblThree" Text="<%#getPercent(vote3) %>" runat="server"></asp:Label>
<asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="投 票" /></div>
</form>
</body>
</html>C# 实现代码部分:using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class _Default : System.Web.UI.Page
{
protected static int vote1 = 0;
protected static int vote2 = 0;
protected static int vote3 = 0; protected void Page_Load(object sender, EventArgs e)
{ }
protected void Button1_Click(object sender, EventArgs e)
{
vote1 = vote1 + 1;
//lblOne.Text = vote1.ToString();
this.DataBind();
}
protected void Button2_Click(object sender, EventArgs e)
{
vote2 = vote2 + 1;
//lblTwo.Text = vote2.ToString(); this.DataBind();
}
protected void Button3_Click(object sender, EventArgs e)
{
vote3 = vote3 + 1;
//lblThree.Text = vote3.ToString();
this.DataBind();
} /// <summary>
/// 投票的百分比
/// </summary>
/// <param name="v_vote"></param>
/// <returns></returns>
protected string getPercent(int v_vote)
{
int total = vote1 + vote2 + vote3;
return (Convert.ToDouble(v_vote) / Convert.ToDouble(total) * 100).ToString() + "%";
}
}
{
int i,j;
j=从数据库中得到投票的人数+1;
if(radioButton1.checked)
{
i=从数据库中提取那个数+3;
}
if(radioButton2.checked)
{
Int i=从数据库中提取那个数+3;
}
if(radioButton3.checked)
{
Int i=从数据库中提取那个数+3;
}
}
i代表分数,j代表投票的人数
{
int i,j;
j=从数据库中得到投票的人数+1;
if(radioButton1.checked)
{
i=从数据库中提取那个数+3;
}
if(radioButton2.checked)
{
Int i=从数据库中提取那个数+4;
}
if(radioButton3.checked)
{
Int i=从数据库中提取那个数+5;
}
}
i代表分数,j代表投票的人数
呵呵,不好意思,