You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
714 B

<%@ Page Language="C#" ASPCOMPAT="TRUE" Debug="true" Inherits="OboutInc.oboutAJAXPage" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script language="C#" runat="server">
public string onVote(int qNr, int aNr, int nrOfAnswers)
{
string result = qNr.ToString();
int [] q = new int [nrOfAnswers + 1];
// connect to the database
OleDbConnection myConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("../App_Data/vote.mdb") + ";User Id=Admin;Password=;");
OleDbCommand myComm;
myConn.Open();
// add 1 vote to the answer chosen
myComm = new OleDbCommand("UPDATE VoteOption set Result=Result+1 where QID=" + qNr + " and AID=" + aNr, myConn);
myComm.ExecuteNonQuery();