troubleshooting Question

Syntax error converting the varchar value 'undefined' to a column of data type int.

Avatar of ismnanie
ismnanie asked on
JavaScriptWeb DevelopmentASP
4 Comments1 Solution752 ViewsLast Modified:
I've got this error message in my browser after clicking the 'Send' button.
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value 'undefined' to a column of data type int.

I hope somebody can help me to solve this problem.
<script type="text/javascript">
function addOther(){
  if (document.form1.other.checked==true) {
  var newtextbox=document.createElement("input")
  newtextbox.setAttribute('type', 'text');
  newtextbox.setAttribute('id', 'idtextbox');
  newtextbox.setAttribute('name', 'idtextbox');
  newtextbox.value = "";
  //append new textbox to another div
  else {
  var mydiv=document.getElementById("test")
  var child=mydiv.getElementsByTagName("input");
  if(child.length>0) {
  mydiv.removeChild(child[0]); }
  document.getElementById("textother").value = "";

<form name="form1">
  <input type="checkbox" name="iem" id="iem" value="IEM" >IEM<br />
  <input type="checkbox" name="bem" id="bem" value="BEM" >BEM<br />
  <input type="checkbox" name="ngo" id="ngo" value="NGOs" >NGOs<br />
  <input type="checkbox" name="welfare" id="welfare" value="Welfare Service"  />Welfare Service<br />
  <input type="checkbox" name="relief" id="relief" value="Disaster Relief Team" >Disaster Relief Team<br />
  <input type="checkbox" name="other" value="Other" onClick="addOther();">Other<br />
  <div id="test"></div>
    <input type="submit" name="btnSend" value="Send" id="Submit";/>
    <input value="<%=stfid%>" name=user type=text>

if (Request ("btnsend")=="Send") {

var srv_iem = Request.Form("iem");
var srv_bem = Request.Form("bem");
var srv_ngo = Request.Form("ngo");
var srv_wfr = Request.Form("wlfr");
var srv_rlf = Request.Form("rlf");
var srv_otr = Request.Form("idtextbox");
var srv_stf = Request.Form("user");

var Conn = Server.CreateObject("ADODB.Connection");

sql = "INSERT INTO tblService (service_iem, service_bem, service_ngo, service_wlfr, service_rlf, service_other, staff_id) VALUES (' "+srv_iem+" ', ' "+srv_bem+" ', ' "+srv_ngo+" ', ' "+srv_wfr+" ', ' "+srv_rlf+" ', ' "+srv_otr+" ', ' "+srv_stf+" ')";




Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros