asp.net - No value given for one or more required parameters. vb -


well, i've rooted around asked questions, changed code 3 or 4 times , still unable form i'm working on insert data table. looking helpful suggestions.

form code:

<div>     <table align="center" width="200px" cellpadding="5px">         <tr><td width="50px">season:</td><td width="150px">             <asp:dropdownlist name="season" id="ddlseason" runat="server" autopostback="true" datasourceid="sqldatasource1" datatextfield="season" datavaluefield="season">             </asp:dropdownlist>             <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:seasonconnectionstring %>" providername="<%$ connectionstrings:seasonconnectionstring.providername %>" selectcommand="select * [t_season] order [season]"></asp:sqldatasource>             </td></tr>         <tr><td>game: </td><td>             <asp:dropdownlist name="game" id="ddlgamenumber" runat="server" autopostback="true" datasourceid="sqldatasource2" datatextfield="game" datavaluefield="game">             </asp:dropdownlist>             <asp:sqldatasource id="sqldatasource2" runat="server" connectionstring="<%$ connectionstrings:gamenumberconnectionstring %>" providername="<%$ connectionstrings:gamenumberconnectionstring.providername %>" selectcommand="select * [t_gamenumbers] order [game]"></asp:sqldatasource>             </td></tr>         <tr><td>team: </td><td>             <asp:dropdownlist name="team" id="ddlteam" runat="server" height="16px" width="122px" autopostback="true" datasourceid="sqldatasource3" datatextfield="team" datavaluefield="team">             </asp:dropdownlist>             <asp:sqldatasource id="sqldatasource3" runat="server" connectionstring="<%$ connectionstrings:teamconnectionstring %>" providername="<%$ connectionstrings:teamconnectionstring.providername %>" selectcommand="select distinct * [t_teams] order [team]"></asp:sqldatasource>             </td></tr>         <tr><td>player: </td><td>             <asp:dropdownlist name="player" id="ddlplayer" runat="server" height="16px" width="121px" autopostback="true" datasourceid="sqldatasource4" datatextfield="player" datavaluefield="player">             </asp:dropdownlist>             <asp:sqldatasource id="sqldatasource4" runat="server" connectionstring="<%$ connectionstrings:playerconnectionstring %>" providername="<%$ connectionstrings:playerconnectionstring.providername %>" selectcommand="select distinct [team], [player] [t_passing] (([season] = ?) , ([team] = ?)) order [player]">                 <selectparameters>                     <asp:controlparameter controlid="ddlseason" name="season" propertyname="selectedvalue" type="string" />                     <asp:controlparameter controlid="ddlteam" name="team" propertyname="selectedvalue" type="string" />                 </selectparameters>             </asp:sqldatasource>             </td></tr>         <tr><td>atts: </td><td>             <asp:dropdownlist name="atts" id="ddlatts" runat="server" datasourceid="sqldatasource5" datatextfield="game" datavaluefield="game">             </asp:dropdownlist>             <asp:sqldatasource id="sqldatasource5" runat="server" connectionstring="<%$ connectionstrings:attsconnectionstring %>" providername="<%$ connectionstrings:attsconnectionstring.providername %>" selectcommand="select * [t_atts] order [game]"></asp:sqldatasource>             </td></tr>         <tr><td>comps: </td><td>             <asp:dropdownlist name="comps" id="ddlcomps" runat="server" datasourceid="sqldatasource6" datatextfield="comps" datavaluefield="comps">             </asp:dropdownlist>             <asp:sqldatasource id="sqldatasource6" runat="server" connectionstring="<%$ connectionstrings:completionsconnectionstring %>" providername="<%$ connectionstrings:completionsconnectionstring.providername %>" selectcommand="select * [t_comps] order [comps]"></asp:sqldatasource>             </td></tr>         <tr><td>yards: </td><td>             <asp:textbox name="yards" id="txtyards" runat="server" width="68px" text="0"></asp:textbox>             </td></tr>         <tr><td>tds: </td><td>             <asp:dropdownlist name="tds" id="ddltds" runat="server" datasourceid="sqldatasource7" datatextfield="tds" datavaluefield="tds">             </asp:dropdownlist>             <asp:sqldatasource id="sqldatasource7" runat="server" connectionstring="<%$ connectionstrings:tdconnectionstring %>" providername="<%$ connectionstrings:tdconnectionstring.providername %>" selectcommand="select * [t_tds] order [tds]"></asp:sqldatasource>             </td></tr>         <tr><td>ints: </td><td>             <asp:dropdownlist name="ints" id="ddlints" runat="server" datasourceid="sqldatasource8" datatextfield="ints" datavaluefield="ints">             </asp:dropdownlist>             <asp:sqldatasource id="sqldatasource8" runat="server" connectionstring="<%$ connectionstrings:intsconnectionstring %>" providername="<%$ connectionstrings:intsconnectionstring.providername %>" selectcommand="select * [t_ints] order [ints]"></asp:sqldatasource>             </td></tr>         <tr><td>long: </td><td>             <asp:textbox name="longest" id="txtlongest" runat="server" width="67px" text="0"></asp:textbox>             </td></tr>         <tr><td colspan="2" align="center">             <asp:button id="btnsubmit" runat="server" text="submit" />&nbsp;&nbsp;             <asp:button id="btncancel" runat="server" text="cancel" />             </td></tr>     </table> </div> 

code behind:

protected sub btnsubmit_click(sender object, e eventargs) handles btnsubmit.click     dim season string = request.form("season")     dim game string = request.form("game")     dim team string = request.form("team")     dim player string = request.form("player")     dim atts string = request.form("atts")     dim comps string = request.form("comps")     dim yards string = request.form("yards")     dim tds string = request.form("tds")     dim ints string = request.form("ints")     dim longest string = request.form("longest")      dim objconnection oledbconnection = nothing     dim objcmd oledbcommand = nothing      dim sqlstring string     dim dbconn oledbconnection = nothing      dbconn = new oledbconnection("provider=microsoft.ace.oledb.12.0;data source=" & server.mappath("~/app_data/tcflstatistics.accdb"))     dbconn.open()      sqlstring = "insert t_passing (season, game, team, player, atts, comps, yards, tds, ints, longest) values (?,?,?,?,?,?,?,?,?,?)"     objcmd = new oledbcommand(sqlstring, dbconn)     objcmd.parameters.addwithvalue("@season", ddlseason.selectedvalue.tostring)     objcmd.parameters.addwithvalue("@game", ddlgamenumber.selectedvalue.tostring)     objcmd.parameters.addwithvalue("@team", ddlteam.selectedvalue.tostring)     objcmd.parameters.addwithvalue("@player", ddlplayer.selectedvalue.tostring)     objcmd.parameters.addwithvalue("@atts", ddlatts.selectedvalue.tostring)     objcmd.parameters.addwithvalue("@comps", ddlcomps.selectedvalue.tostring)     objcmd.parameters.addwithvalue("@yards", txtyards.text)     objcmd.parameters.addwithvalue("@tds", ddltds.selectedvalue.tostring)     objcmd.parameters.addwithvalue("@ints", ddlints.selectedvalue.tostring)     objcmd.parameters.addwithvalue("@longest", txtlongest.text)     objcmd.executenonquery()      dbconn.close()     msgbox("record submitted successfully!")  end sub 

i found answer own question!

as continued scroll through numerous similar questions 1 person suggested using response.write command show sql string make sure looked correct. inserted response.write command show connection string , sql string verify accuracy. still got same error. had bright idea of commenting out submit button code. ran code again , got same error message. told me error not in submission code.

i moved on form portion of code , began commenting out text boxes , drop down lists 1 @ time starting @ end. found had changed column header in table after had made sqldatasource link in portion of code:

<asp:dropdownlist name="atts" id="ddlatts" runat="server" datasourceid="sqldatasource5" datatextfield="game" datavaluefield="game">         </asp:dropdownlist>         <asp:sqldatasource id="sqldatasource5" runat="server" connectionstring="<%$ connectionstrings:attsconnectionstring %>" providername="<%$ connectionstrings:attsconnectionstring.providername %>" selectcommand="select * [t_atts] order [game]"></asp:sqldatasource> 

once changed game atts in applicable portions of code worked charm!

thank took time read question, submit answer or answered 1 of many other similar questions lead me solution!


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -