2014-03-13 33 views
2

我正在製作一個頁面,我需要通過單選按鈕接受/拒絕來自我的表中的行,然後將該行數據發送到SQL中的表中。無法將單選按鈕值發送到SQL

我一直堅持這幾天,現在我無法找到任何有用的信息,所以任何幫助將不勝感激!

這裏是我的HTML:

<div> 
    <form id="canceltable" onsubmit="" method="post" action="admin.asp"> 
     <table id="CancelRequestTable"> 
      <tr> 
       <td style="width: 200px;" /> 
       <td style="width: 200px;" /> 
       <td style="width: 200px;" /> 
       <td style="width: 200px;" /> 
      </tr> 
      <tr> 
       <th colspan="4">Cancel Request Table</th> 
      </tr> 
      <tr> 
       <td>Name</td> 
       <td>Start Date</td> 
       <td>End Date</td> 
       <td>Accept/Decline</td> 
      </tr> 
      <% Set objDBConn=S erver.CreateObject("ADODB.Connection") objDBConn.Open "Provider=sqloledb;Data Source=*****\SQL2012;Initial Catalog=*****;User ID=****;Password=****;" Set objDBCommand=S erver.CreateObject("ADODB.Command") objDBCommand.ActiveConnection=o bjDBConn objDBCommand.CommandText="spCancelRequestTable" objDBCommand.CommandType=a dCmdStoredProc Set objDBRS=S erver.CreateObject("ADODB.RecordSet") objDBRS.open objDBCommand,,adOpenForwardOnly Do until objDBRS.eof %> 
      <tr> 
       <td class="Column4Table"> 
        <%response.Write(objDBRS(0))%> 
       </td> 
       <td class="Column4Table"> 
        <%response.Write(objDBRS(1))%> 
       </td> 
       <td class="Column4Table"> 
        <%response.Write(objDBRS(2))%> 
       </td> 
       <td> 
        <input type="radio" name="radio<%=a%>" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
        <input type="radio" name="radio<%=a%>" /> 
       </td> 
      </tr>  
      <tr> 
       <% 
         a=a+1 
         objDBRS.movenext 
        Loop 
        Set objDBCommand=nothing 
        objDBConn.Close 
        Set objDBConn=nothing 
       %> 
      </tr> 
     </table> 
     <div id="ButtonSubmit2"> <strong><i>Submit</i></strong></div> 
    </form> 
</div> 
+0

S erver.CreateObject =>這是否工作?也許添加asp標籤到你的問題。您可以提供更多信息 - 問題是什麼以及迄今爲止您嘗試了什麼。 –

+0

你的admin.asp頁面是什麼樣的 - 特別是你的request.form語句和你的數據庫插入代碼? – John

+0

@ByronMcGrath這個問題解決了嗎?這是一個像F.Müller提到的錯字嗎?這個問題最終被拋棄了。請幫助保持整潔並努力尋求某種解決方案。如果問題出現了,那麼您可以考慮刪除該問題,因爲這對於未來的所有SO讀者來說都是低價值的。如果Nathan Rice的答案是解決方案,請給它一個綠色的勾號。否則,請通過澄清你的問題或評論Nathan的答案尋求額外的幫助。 – mickmackusa

回答

0

你是不是通過你的單選按鈕的值屬性。你想這樣的事情:

<form id="form1" name="form1" method="post"> 
    <input type="radio" name="RadioGroup1" value="radio<%=sql1%>" id="RadioGroup1_0"> 
    <input type="radio" name="RadioGroup1" value="radio<%=sql2%>" id="RadioGroup1_1"> 
</form>