inserting into an access database

Discussion in 'ASP' started by milly999, Apr 15, 2008.

  1. milly999

    milly999 New Member

    Apr 14, 2008
    Likes Received:
    Trophy Points:
    Student / Web Developer / Designer
    Wales, UK
    hi everyone i was wondring if anyone could help me please! i used this code the other day and it was working fine, but then i put this required field validator in and now the sqldatasource is only inserting null values into my database! can someone help me out PLEASE!!!
    <SCRIPT runat="server">
        Private Sub InsertVote(ByVal Source As Object, ByVal e As EventArgs)
        End Sub    
    <form id="form1" runat="server">   	 
        Please can you enter your Account ID into the box below, then select the party you wish to vote for by clicking the down arrow and navigatinging to the party of your choice then click the Submit button.
         <br /> 
         <br />
      Account ID: <asp:TextBox id="TextBox1" runat="server"/> 
       <br />     
     	 <asp:RequiredFieldValidator ID="Validator1" 
     	 ControlToValidate="TextBox1" ErrorMessage="Please enter your account number" 
     	 runat="server"  /> 	 
           <br /> <br />
         Party Selection: 
         <asp:dropdownlist id="Dropdownlist1" runat="server" datasourceid="SqlDataSource1" datatextfield="Party" AppendDataBoundItems="true">
        <asp:ListItem Value="" Text="Please Select"/>
        <br />
        <asp:RequiredFieldValidator ID="Validator2" ControlToValidate="Dropdownlist1"
        ErrorMessage="Please can you select the party you wish to vote for" runat="server"/>
     <br />
            selectcommand="SELECT Party.Party FROM Party"
            insertcommand="INSERT INTO Vote(AccountId,Vote) VALUES (Account,Vote)" 
            ConnectionString="<%$ ConnectionStrings:VotingConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:VotingConnectionString.ProviderName %>">
            <asp:FormParameter Name="Account" Type="String" FormField="AccountNumber" /> 
            <asp:FormParameter Name="Party" Type="String" FormField="PartyList"   />
            <br />
            <asp:button id="Button1" runat="server" text="Submit"  onclick="InsertVote"/> 
    Last edited by a moderator: Apr 16, 2008

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice