Link to home
Start Free TrialLog in
Avatar of introlux
introluxFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Error: No value given for one or more required parameters. HELP!!!

Hi guys, I have been using this code for a while and it was working before. Now for some strange reason it does not work! Any idea:

I have a table that contains input boxes for user to input data which will then write to a database. It was working with about 5 fields, now that I have entered more. Im having trouble working it when clickin on the button to add the details. I get an error message saying:

No value given for one or more required parameters.

Any help will be appreciated.

Thanks,

introlux
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CreateProCom.aspx.cs" Inherits="CreateProCom" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Security.Cryptography" %>
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Password Hashing (CS)</title>
<script runat="server" language="C#">
    OleDbConnection objConn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\\ProCom.mdb");
    OleDbCommand objCmd; 
        string sqlCmd; 
        RNGCryptoServiceProvider objRng = new RNGCryptoServiceProvider();
        int intSaltSize = 16;
 
    void AddCredentials_Click(Object s, EventArgs e)
    {
        sqlCmd = "INSERT INTO tblProCom (Pid, PName, ICD_IDF, PType, CName, PContact, SContact, NumSurvey, WNumber, Market, Languages, EstSurvLen, TotNoQues, SampSource, SampCri, TargNoComp, TargNoQuo_Mark, InciRate, CPCIR, FStart, FFinish, ProvOfQues, TestLink, FDataDel, Livewire, NumIntDataSet, Other, FDataSet, Tables, CodFrameGen, Coding, DataMerg, Ques, Stim, Samp, Soli, DPSpec) VALUES (@Pid, @PName, @ICD_IDF, @PType, @CName, @PContact, @SContact, @NumSurvey, @WNumber, @Market, @Languages, @EstSurvLen, @TotNoQues, @SampSource, @SampCri, @TargNoComp, @TargNoQuo_Mark, @InciRate, @CPCIR, @FStart, @FFinish, @ProvOfQues, @TestLink, @FDataDel, @Livewire, @NumIntDataSet, @Other, @FDataSet, @Tables, @CodFrameGen, @Coding, @DataMerg, @Ques, @Stim, @Samp, @Soli, @DPSpec)";
        OleDbCommand objCmd = new OleDbCommand(sqlCmd, objConn);
        objCmd.Parameters.Add("@Pid", txtPid.Text);
        objCmd.Parameters.Add("@PName", txtPName.Text);
        objCmd.Parameters.Add("@ICD_IDF", txtICD_IDF.Text);
        objCmd.Parameters.Add("@PType", txtPType.Text);
        objCmd.Parameters.Add("@CName", txtCName.Text);
        objCmd.Parameters.Add("@PContact", txtPContact.Text);
        objCmd.Parameters.Add("@SContact", txtSContact.Text);
        objCmd.Parameters.Add("@NumSurvey", txtNumSurvey.Text);
        objCmd.Parameters.Add("@WNumber", txtWNumber.Text);
        objCmd.Parameters.Add("@Market", txtMarket.Text);
        objCmd.Parameters.Add("@Languages", txtLanguages.Text);
        objCmd.Parameters.Add("@EstSurvLen", txtEstSurvLen.Text);
        objCmd.Parameters.Add("@TotNoQues", txtTotNoQues.Text);
        objCmd.Parameters.Add("@SampSource", txtSampSource.Text);
        objCmd.Parameters.Add("@SampCri", txtSampCri.Text);
        objCmd.Parameters.Add("@TargNoComp", txtTargNoComp.Text);
        objCmd.Parameters.Add("@TargNoQuo_Mark", txtTargNoQuo_Mark.Text);
        objCmd.Parameters.Add("@InciRate", txtInciRate.Text);
        objCmd.Parameters.Add("@CPCIR", txtCPCIR.Text);
        objCmd.Parameters.Add("@FStart", txtFStart.Text);
        objCmd.Parameters.Add("@FFinish", txtFFinish.Text);
        objCmd.Parameters.Add("@TestLink", txtTestLink.Text);
        objCmd.Parameters.Add("@FDataDel", txtFDataDel.Text);
        objCmd.Parameters.Add("@Livewire", txtLivewire.Text);
        objCmd.Parameters.Add("@NumIntDataSet", txtNumIntDataSet.Text);
        objCmd.Parameters.Add("@Other", txtOther.Text);
        objCmd.Parameters.Add("@FDataSet", txtFDataSet.Text);
        objCmd.Parameters.Add("@Tables", txtTables.Text);
        objCmd.Parameters.Add("@CodFrameGen", txtCodFrameGen.Text);
        objCmd.Parameters.Add("@Coding", txtCoding.Text);
        objCmd.Parameters.Add("@DataMerg", txtDataMerg.Text);
        objCmd.Parameters.Add("@Ques", txtQues.Text);
        objCmd.Parameters.Add("@Stim", txtStim.Text);
        objCmd.Parameters.Add("@Samp", txtSamp.Text);
        objCmd.Parameters.Add("@Soli", txtSoli.Text);
        objCmd.Parameters.Add("@DPSpec", txtDPSpec.Text);     
 
        objConn.Open();
        objCmd.ExecuteNonQuery();
        objConn.Close();
}
</script>
</head>
<body>
 
<br />
<div style="margin-left:auto; margin-right:auto; width:60%;">
<table cellpadding="5" cellspacing="0" border="2" width="100%">
<tr>
<td>
<form id="Form1" runat="server">
    <h2 style="text-align: center">Create New Project Commissioning</h2>
    <br />
 
<asp:Table id="Table2" runat="server" CellPadding="3" CellSpacing="0">
        <asp:TableRow TableSection="TableHeader" BackColor="Pink">
                <asp:TableCell Text="Project Commissioning Form" ColumnSpan="3" />
        </asp:TableRow>
        <asp:TableRow TableSection="TableFooter" BackColor="Pink">
            <asp:TableCell Text="" ColumnSpan="3" />
        </asp:TableRow>
</asp:Table>
    <br />     
<asp:Table id="Table3" runat="server" CellPadding="3" CellSpacing="0">
        <asp:TableRow TableSection="TableHeader" BackColor="Pink">
                <asp:TableCell Text="Project Details" ColumnSpan="3" />
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell Text="Project ID:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtPid" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell Text="Project Name:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtPName" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell Text="ICD/IDF:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtICD_IDF" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell Text="Project Type:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtPType" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell Text="Client Name:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtCName" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell Text="Primary Contact:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtPContact" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell Text="Sales Contact:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtSContact" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>           
        <asp:TableRow TableSection="TableFooter" BackColor="Pink">
            <asp:TableCell Text="" ColumnSpan="3" />
        </asp:TableRow>
</asp:Table>
 
    <br />
 
<asp:Table id="Table4" runat="server" CellPadding="3" CellSpacing="0">
        <asp:TableRow TableSection="TableHeader" BackColor="Pink">
            <asp:TableCell Text="Survey & Sample Details" ColumnSpan="3" />
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell Text="No. Of Surveys:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtNumSurvey" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>         
        <asp:TableRow>
            <asp:TableCell Text="Wave number (i.e.. 1 of 3):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtWNumber" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell Text="Market(s):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtMarket" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>                             
        <asp:TableRow>
            <asp:TableCell Text="Languages:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtLanguages" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>  
        <asp:TableRow>
            <asp:TableCell Text="Estimated Survey Length (mins per survey):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtEstSurvLen" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>                 
        <asp:TableRow>
            <asp:TableCell Text="Total no. of Questions (per survey):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtTotNoQues" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>  
        <asp:TableRow>
            <asp:TableCell Text="Sample Source: (per survey (client or IDF)):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtSampSource" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell Text="Sample criteria: (per survey):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtSampCri" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>      
        <asp:TableRow>
            <asp:TableCell Text="Target no. of completes: (per survey):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtTargNoComp" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow> 
        <asp:TableRow>
            <asp:TableCell Text="Target by quotas/markets:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtTargNoQuo_Mark" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow> 
        <asp:TableRow>
            <asp:TableCell Text="Incidence rate (%) (per survey):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtInciRate" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow> 
         <asp:TableRow>
            <asp:TableCell Text="CPC @ IR (£ per survey):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtCPCIR" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow> 
        <asp:TableRow TableSection="TableFooter" BackColor="Pink">
            <asp:TableCell Text="" ColumnSpan="3" />
        </asp:TableRow>
</asp:Table>
    <br />
 
<asp:Table id="Table5" runat="server" CellPadding="3" CellSpacing="0">      
        <asp:TableRow TableSection="TableHeader" BackColor="Pink">
            <asp:TableCell Text="Expected Timings (PM to confirm final timing after questionnaire review)" ColumnSpan="3" />
        </asp:TableRow>
         <asp:TableRow>
            <asp:TableCell Text="Field Start (date per survey):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtFStart" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow> 
         <asp:TableRow>
            <asp:TableCell Text="Field Finish (date per survey):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtFFinish" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow> 
         <asp:TableRow>
            <asp:TableCell Text="Provision of Questionnaire (per survey):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtProvOfQues" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow> 
         <asp:TableRow>
            <asp:TableCell Text="Test Link to Client (per survey):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtTestLink" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow> 
          <asp:TableRow>
            <asp:TableCell Text="Final data delivery (per survey):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtFDataDel" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>        
          <asp:TableRow>
            <asp:TableCell Text="Livewire:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtLivewire" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>         
        <asp:TableRow TableSection="TableFooter" BackColor="Pink">
            <asp:TableCell Text="" ColumnSpan="3" />
        </asp:TableRow>
</asp:Table>
    <br />
 
<asp:Table id="Table8" runat="server" CellPadding="3" CellSpacing="0">
        <asp:TableRow TableSection="TableHeader" BackColor="Pink">
                <asp:TableCell Text="Deliverables" ColumnSpan="3" />
        </asp:TableRow>
        <asp:TableRow TableSection="TableFooter" BackColor="Pink">
            <asp:TableCell Text="" ColumnSpan="3" />
        </asp:TableRow>
</asp:Table>
    <br />
    
<asp:Table id="Table1" runat="server" CellPadding="3" CellSpacing="0">    
        <asp:TableRow TableSection="TableHeader" BackColor="Pink">
                <asp:TableCell Text="Interim Deliverables" ColumnSpan="3" />
        </asp:TableRow>
          <asp:TableRow>
            <asp:TableCell Text="Number of interim data sets (one set of Topline/SpSS/SSS+ASCII/Verbatim as standard):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtNumIntDataSet" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow> 
          <asp:TableRow>
            <asp:TableCell Text="Other Pls Specify (additional cost applies):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtOther" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>    
        <asp:TableRow TableSection="TableFooter" BackColor="Pink">
            <asp:TableCell Text="" ColumnSpan="3" />
        </asp:TableRow>
</asp:Table>
    <br />
 
<asp:Table id="Table6" runat="server" CellPadding="3" CellSpacing="0">       
        <asp:TableRow TableSection="TableHeader" BackColor="Pink">
                <asp:TableCell Text="Final Deliverables" ColumnSpan="3" />
        </asp:TableRow>
          <asp:TableRow>
            <asp:TableCell Text="Final data set(s) (One set of Topline/SPSS/SSS+ASCII/Verbatim as standard):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtFDataSet" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow> 
          <asp:TableRow>
            <asp:TableCell Text="Tables:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtTables" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>   
          <asp:TableRow>
            <asp:TableCell Text="Code Frame Generation:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtCodFrameGen" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>  
          <asp:TableRow>
            <asp:TableCell Text="Coding (if yes, pls specify delivery format: ecel, SPSS, or coded QES and question numbers):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtCoding" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>  
          <asp:TableRow>
            <asp:TableCell Text="Data Merging:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtDataMerg" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>  
        <asp:TableRow TableSection="TableFooter" BackColor="Pink">
            <asp:TableCell Text="" ColumnSpan="3" />
        </asp:TableRow>
</asp:Table>
    <br />
 
<asp:Table id="Table7" runat="server" CellPadding="3" CellSpacing="0">       
        <asp:TableRow TableSection="TableHeader" BackColor="Pink">
            <asp:TableCell Text="Client Deliverables" ColumnSpan="3" />
        </asp:TableRow>
          <asp:TableRow>
            <asp:TableCell Text="Questionnaire:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtQues" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>  
          <asp:TableRow>
            <asp:TableCell Text="Stimulus:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtStim" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>  
          <asp:TableRow>
            <asp:TableCell Text="Sample:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtSamp" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>  
         <asp:TableRow>
            <asp:TableCell Text="Solicitation (client sample only):"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtSoli" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>  
         <asp:TableRow>
            <asp:TableCell Text="DP Spec:"></asp:TableCell>
            <asp:TableCell><asp:TextBox id="txtDPSpec" runat="server" /></asp:TableCell>
            <asp:TableCell Text="(0,2)"></asp:TableCell>
        </asp:TableRow>  
        <asp:TableRow TableSection="TableFooter" BackColor="Pink">
            <asp:TableCell Text="" ColumnSpan="3" />
        </asp:TableRow>
</asp:Table>
 
<br />
 
<asp:Button id="btnLogin" runat="server" Text="Add Credentials" onClick="AddCredentials_Click" />
</form>
</td>
</tr>
</table>
</div>
</body>
</html>

Open in new window

Avatar of renjurdevan
renjurdevan
Flag of India image

Have you left out any field as vaccant? Which may be neccary required one!!
Avatar of introlux

ASKER

My table has loads of fields but have only chosen to enter some of the data in them.
These are my fields in my table:

Used:

Pid      PName      ICD_IDF      PType      CName      PContact      SContact      NumSurvey      WNumber      Market      Languages      EstSurvLen      TotNoQues      SampSource      SampCri      TargNoComp      TargNoQuo_Mark      InciRate      CPCIR      FStart      FFinish      ProvOfQues      TestLink      FDataDel      Livewire      NumIntDataSet      Other      FDataSet      Tables      CodFrameGen      Coding      DataMerg      Ques      Stim      Samp      Soli      DPSpec      


Not used:

ProMan      ProCo-or      Scripter      SampSup      Keyword      SubLine      ActFStartDate      ActFFinishDate      ActFDataDate      ActLenOfInt      FQuotaCount      NumOfQuotaFull      NumOfScreenout      FinalIR      NumOfInSent      FResRate      Issues      OpProStatus      Invoiceable      DelOnTimeSpec      ReasNotCloseTime

Hope this helps!

introlux
ASKER CERTIFIED SOLUTION
Avatar of ron10023
ron10023
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It was driving me mad!! lol something so simple grrrrrrrrrrr!!!