homepage Welcome to WebmasterWorld Guest from 54.226.93.128
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

    
Click submit and it won't enter data into the DB
Cannot figure out why DB records are empty
Sid3ways




msg:3832533
 9:00 pm on Jan 22, 2009 (gmt 0)

I am trying to create a simple ASP page that will be used on our shop floor. I used the layout of the page from another web page we have so I know there is some extra code in there that doesn't get used.

But anyways, I am using Dreamweaver and have setup the insert record to put data into my repairlog database. When I click the submit button, it goes back to the original page like it should, resetting the values, but no records show up in the database. It is still empty. I'm not sure where to start, please let me know what other information you need from me. Thank you! :)

Here is the code for the program.

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/Toolsnet.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
If (CStr(Request("MM_insert")) = "form1") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd

Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_Toolsnet_STRING
MM_editCmd.CommandText = "INSERT INTO dbo.repairlog (p_iSequence, vin, [month], [day], [year], [hour], [minute], operator, supervisor, actions, part) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 201, 1, 10, Request.Form("p_iSequence")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, 17, Request.Form("Vin")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 201, 1, 10, Request.Form("Month")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 201, 1, 10, Request.Form("Day")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 201, 1, 10, Request.Form("Year")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 201, 1, 10, Request.Form("Hour")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 201, 1, 10, Request.Form("Min")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 201, 1, 25, Request.Form("operator")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 201, 1, 25, Request.Form("supervisor")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 201, 1, 10, Request.Form("actions")) ' adLongVarChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param11", 201, 1, 50, Request.Form("part")) ' adLongVarChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "weekly_meeting_input.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<html>
<head>
<title>Repair Log</title>
<link rel="stylesheet" href="../comm/style/ommc.css">
<meta http-equiv="Content-Type" content="text/html; charset=8859_1">
<script language="javascript" src="../comm/js/mainjs.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
function goDetail(val, val2){
pop_open(508,450,'./ProdStatus10.jsp?p_sVINNo='+val+'&p_sSeqNo='+val2);
}

function goPage(val){
document.form1.p_Page.value = val;
clkSearch();
return;
}

function goProdHistory(val, val2) {
if( 2 < 1 ){
noAuth();
return;
}

document.form1.p_sVinNo.value = val;
document.form1.p_sSeqNo.value = val2;

form1.action="Product00.jsp";
form1.target = '_self';
form1.submit();
}

function clkSearch() {
if( 2 < 1 ){
noAuth();
return;
}
form1.action="ProdStatus00.jsp";
form1.target = '_self';
form1.submit();
}

function clkRegister(val){
form1.p_sJobtype.value = val;

form1.action='weekly_meeting_write.asp';
form1.target = '_self';
form1.submit();
}

function clkExcel() {
if( 2 < 1 ){
noAuth();
return;
}

form1.action ="ProdStatusExcel.jsp";
form1.target = 'excel';
form1.submit();
}
//-->
</script>
<style type="text/css">
<!--
.style1 {
font-size: 10pt;
font-weight: bold;
}
-->
</style>
</head>

<body topmargin="0">
<center>
<form ACTION="<%=MM_editAction%>" name="form1" method="POST" enctype="multipart/form-data">
<input type="hidden" name="p_sJobtype">
<input type="hidden" name="p_iSequence" value="<%=iSequence%>">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="200" height="34" class="gray_01"><img src="../images/deco02.gif">Repair Log </td>
<td align="right" background="../images/tit_bg.gif" class="gray_02">
</td>
</tr>
<tr>
<td height="1" colspan="2" bgcolor="E0E0E0"></td>
</tr>
</table>
<img src="../images/sp.gif" height="5"><br>

<table width="80%" border="0" cellpadding="2" cellspacing="1" bgcolor="DBDAD4">
<tr bgcolor="FFFFFF" height="40">
<td>&nbsp;&nbsp;<img src="../images/deco06.gif" alt="Vin6">Enter Last 6 of VIN </td>
<td colspan="3">&nbsp; <input name="GetVin" type="text" id="GetVin" size="8" maxlength="6">
&nbsp; <input name="Vin6" type="button" id="Vin6" value="Get Full Vin"></td>
</tr>
<tr bgcolor="FFFFFF" height="40">
<td>&nbsp;&nbsp;<img src="../images/deco06.gif" alt="Vin6">VIN</td>
<td colspan="3">&nbsp; <input name="Vin" type="text" id="Vin" size="19" maxlength="17"></td>
</tr>
<tr bgcolor="FFFFFF" height="40">
<td width="17%">&nbsp;&nbsp;<img src="../images/deco06.gif">Repair Date</td>
<td width="83%" colspan="3">&nbsp;
<select name="Month" id="Month">
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
&nbsp;
<select name="Day" id="Day">
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
&nbsp;
<select name="Year" id="Year">
<option value="2008">2008</option>
<option value="2009" selected>2009</option>
</select> </td>
</tr>
<tr bgcolor="FFFFFF" height="40">
<td>&nbsp;&nbsp;<img src="../images/deco06.gif">Time</td>
<td>&nbsp;
<select name="Hour" id="Hour">
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
</select>
<span class="style1">:</span>&nbsp;
<select name="Min" id="Min">
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
<option value="36">36</option>
<option value="37">37</option>
<option value="38">38</option>
<option value="39">39</option>
<option value="40">40</option>
<option value="41">41</option>
<option value="12">42</option>
<option value="43">43</option>
<option value="44">44</option>
<option value="45">45</option>
<option value="46">46</option>
<option value="47">47</option>
<option value="48">48</option>
<option value="49">49</option>
<option value="50">50</option>
<option value="51">51</option>
<option value="52">52</option>
<option value="53">53</option>
<option value="54">54</option>
<option value="55">55</option>
<option value="56">56</option>
<option value="57">57</option>
<option value="58">58</option>
<option value="59">59</option>
</select></td>
</tr>
<tr bgcolor="FFFFFF" height="35">
<td height="30">&nbsp;&nbsp;<img src="../images/deco06.gif" alt="Operator">Repairing Operator</td>
<td>&nbsp; <select name="operator" id="operator">
<option>Select Operator</option>
<option value="Andy Gibbons">Andy Gibbons</option>
</select> </td>
</tr>
<tr bgcolor="FFFFFF" height="35">
<td height="30">&nbsp;&nbsp;<img src="../images/deco06.gif" alt="Operator">Verifying Supervisor </td>
<td>&nbsp;
<select name="supervisor" id="supervisor">
<option>Select Supervisor</option>
<option value="Sunny Jung">Sunny Jung</option>
</select></td>
</tr>
<tr bgcolor="FFFFFF" height="35">
<td height="30">&nbsp;&nbsp;<img src="../images/deco06.gif">Action</td>
<td> &nbsp;
<select name="actions" id="actions">
<option value="change" selected>Change</option>
<option value="repair">Repair</option>
</select> &nbsp;
<select name="part" id="part">
<option selected>Select Part</option>
<option value="fueltank">Fuel Tank</option>
<option value="frontbumper">Front Bumper</option>
<option value="rearbumper">Rear Bumper</option>
<option value="driveshaft">Drive Shaft</option>
<option value="sensor">O2 Sensor</option>
<option value="abswire">ABS Wires</option>
<option value="dustshield">Dust Shield</option>
<option value="wiring">Wiring (Input Description)</option>
<option value="powersteering">Power Steering Gear</option>
<option value="enginetrans">Engine/Trans</option>
<option value="axlevent">Rear Axle Vent Hose</option>
<option value="transisolator">Transmission Isolator</option>
<option value="brakesystem">Brake System (Input Description)</option>
<option value="other">Other (Input Description)</option>
</select>
</td>
</tr>
</table>
<br>
<table width="60%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="43%" height="25" align="center"><a href="javascript:clkRegister('R');">
<input name="Submit" type="submit" class="gray_01" value="Submit">
</a></td>
<td width="57%" height="25" align="center"><a href="javascript:clkRegister('M');">
<input type="reset" name="Submit2" value="Reset">
</a></td>
<td width="0%" height="25" align="center"><a href="javascript:clkRegister('D');"></a></td>
</tr>
</table>

<input type="hidden" name="MM_insert" value="form1">
</center>
</form>
</body>
</html>

 

mattur




msg:3833063
 1:38 pm on Jan 23, 2009 (gmt 0)

Response.Redirect(MM_editRedirectUrl)

You're not seeing the error message because you're redirecting. You need to identify the error before you try to fix it. Temporarily remove the redirect line above so you can see the ASP error message, which should explain what the problem is.

If you're using IE as your browser you may have to turn off "show friendly HTTP error messages" in Internet Options to see the actual error.

Sid3ways




msg:3833084
 2:00 pm on Jan 23, 2009 (gmt 0)

I just removed the line and I am getting the same result. Nothing into the DB and it just reloads the page. I really appreciate the suggestion, do you have any other ideas?

mattur




msg:3833235
 4:55 pm on Jan 23, 2009 (gmt 0)

OK so that suggests the database insert code isn't being called by the page.

On closer inspection, your form submit is saying you're doing a binary file upload:

<form ACTION="<%=MM_editAction%>" name="form1" method="POST" [b]enctype="multipart/form-data"> [/b]

Change it to a normal form:

<form ACTION="<%=MM_editAction%>" name="form1" method="POST">

Sid3ways




msg:3840705
 10:50 pm on Feb 2, 2009 (gmt 0)

I forgot to come back here and mention mattur that your suggestion did work. I really appreciate the help!

Now I'm on a seperate issue of how to use a recordset. I created a recordset that when I use the test button, returns the correct value, I just can't figure out WHAT to do at this point. I have a field where the user puts in 6 digits. I want them to hit the button I placed next to the text box. This button should activate the recordset I created which takes those 6 digits and returns the entire 17 digit value and puts this 17 digit value into the box below.

Any suggestions? Thanks!

mattur




msg:3841307
 4:38 pm on Feb 3, 2009 (gmt 0)

It sounds like you want to use AJAX - querying the database on the server without refreshing the page in the browser(?)

I'd suggest starting a new thread for your new question. Try writing a simple page isolating just the code you need for this function, asking for help if you need it. Then when you've got it working integrate it into the form you're working on. As with all things IT, the way to approach a problem is to break it down into manageable chunks.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved