|
 |
asp_databases thread: RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
Message #1 by Hayes_Eoin@e... on Mon, 15 Apr 2002 15:36:54 -0400
|
|
Still no good. Same error again
-----Original Message-----
From: Peter Foti (PeterF) [mailto:PeterF@S...]
Sent: Monday, April 15, 2002 3:14 PM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
Your MentorID, SalaryLevel, and TeamID options do not have any values
associated with them. I think this is the cause of your problem. When
you are submitting the form, these inputs essentially have no value.
Try doing something like this:
Mentor ID <select name="MentorID" size="1">
<option value="1901" selected> 1901
<option value="1902"> 1902
<option value="1903"> 1903
<option value="1904"> 1904
<option value="1905"> 1905
<option value="1906"> 1906
<option value="1907"> 1907
<option value="1908"> 1908</option>
</select>
Do this for each of your select boxes.
Regards,
Pete
> -----Original Message-----
> From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
> Sent: Monday, April 15, 2002 10:58 AM
> To: ASP Databases
> Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
> ntax near ',' - line 137
>
>
> <%Option Explicit%>
>
> <html>
> <head>
> META http-equiv=3D"Refresh" content=3D"15";
> url=3D"http://apcintern03/Eoinasp/page1.asp"
> <title>Eoin's first Page</title></head>
>
>
> <body bgcolor="#0000a0" text="#ffffff">
>
>
> <a href="http://apcintern03/EoinASP/"
> ><FONT color=white
> >PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
> </FONT>
>
>
>
>
>
>
> <table BORDER="4" ALIGN="center" CELLPADDING="5"
> COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
> <colgroup>
> <col ALIGN="middle">
> <col ALIGN="middle">
> <col ALIGN="middle">
> </colgroup>
> <caption ALIGN="top"><big><u>Employee Database</u></big>
> </caption><BR>
> <thead>
> <TR>
> <th>ID Number
> <th>Employee Name</th>
> <th>Extension No</th>
> <th>Mentor ID</th>
> <th>Salary Level</th>
> <th>Team ID</th></TR>
> </thead>
> <TBODY>
> <tr></tr>
> <tbody>
>
>
>
>
> <%
>
> Dim Conn, selectSQL, RecSet
>
>
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.Open "Driver={SQL
> Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=Ex
> ampleDB;"
>
> selectSQL = "SELECT * FROM Employee"
> Set RecSet = Conn.Execute (selectSQL)
> If NOT RecSet.EOF THEN
>
> DO UNTIL RecSet.EOF
> Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>"
> & "<TD>" &
> RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo")
> & "</TD>" &
> "<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" &
> RecSet("SalaryLevel") &
> "</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
> RecSet.MoveNext
> Loop
>
> End If
>
> RecSet.Close
> Set RecSet = Nothing
>
> %>
>
>
>
>
>
> </tbody>
> <br><br>
>
> <b><u>Fill in Form in order to Submit New Employee to Employee
> Database</u></b><br>
>
>
>
>
> <form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
> METHOD=get id=form1 name=form1>
> ID Number <input name="IDNumber" size="4" maxlength="4" >
> Name <input name="Name" size="35" maxlength="25" ><br><br>
> Extension No <input name="ExtensionNo" size="10" maxlength="10" >
> Mentor ID <select name="MentorID" size="1">
> <option selected> 1901
> <option> 1902
> <option> 1903
> <option> 1904
> <option> 1905
> <option> 1906
> <option> 1907
> <option> 1908</option>
> </select>
> Salary Level <select name="SalaryLevel" size="1">
> <option selected> 1
> <option> 2
> <option> 3
> <option> 4
> <option> 5</option>
> </select>
> TeamID <select name="TeamID" value="" size="1">
> <option selected
> > JT
> <option> JT2
> <option> NET
> <option> VBT
> <option> DBT
> <option> ASPT</option>
> </select><br><br>
> <input value="Submit New Employee" type="submit" id=submit1
> name=submit1>
> <input value="Reset" type="reset" name="reset">
> </form><br>
>
>
>
>
>
>
>
> <%
> Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
> strTeamID, strSQL
>
> if Request.QueryString<>"" then
> nIDNumber = Request.QueryString("IDNumber")
> strEmpName = Request.QueryString("EmpName")
> strExtensionNo = Request.QueryString("ExtensionNo")
> nMentorID = Request.QueryString("MentorID")
> nSalaryLevel = Request.QueryString("SalaryLevel")
> strTeamID = Request.QueryString("TeamID")
> end if
>
> strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
> StrQuoteReplace(strEmpName) & "','" &
> StrQuoteReplace(strExtensionNo) & "',"
> & nMentorID & "," & nSalaryLevel & ",'" &
> StrQuoteReplace(strTeamID) & "')"
>
> Response.Write(strSQL)
>
> Conn.Execute(strSQL)
>
> Conn.Close
> set Conn = nothing
>
>
> Function StrQuoteReplace(strValue)
> StrQuoteReplace = Replace(strValue, "'", "''")
> End Function
>
> %>
>
>
> </table>
> </body>
> </html>
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: Craig Flannigan [mailto:ckf@k...]
> Sent: Monday, April 15, 2002 10:33 AM
> To: ASP Databases
> Subject: [asp_databases] RE: HELP!!!!! 80040E14 error -
> Incorrect syntax
> near ',' - line 137
>
>
> It means that an error has occurred near one of your commas
> in your SQL
> code.
>
> Check that users are not putting ' marks in the boxes. If
> their name has
> apostrophes in it, then it will cause your SQL to fail.
>
> To get around this, use the replace command.
>
> strName = Replace(Request.form("Name"),"'","''")
>
> strName is now inserted into the SQL string instead of
> Request.form("Name")
>
>
>
> HTH
> Craig.
>
>
>
>
>
>
> -----Original Message-----
> From: Eoin Hayes [mailto:Hayes_Eoin@e...]
> Sent: 15 April 2002 15:30
> To: ASP Databases
> Subject: [asp_databases] HELP!!!!! 80040E14 error - Incorrect syntax
> near ',' - line 137
>
>
> I keep getting this 80040E14 error when I try to get the page
> up. The page
> contains textboxes where the user can enter employee details and then
> submit them to enter a new employee to an employee database
> in SQL Server.
> The error indicates to line 137 i.e. Conn.Execute (strSQL)
> What is incorrect syntax near ',' all about???
>
> Here is my code:
>
> <%Option Explicit%>
>
> <html>
> <head>
> META http-equiv=3D"Refresh" content=3D"15";
> url=3D"http://apcintern03/Eoinasp/page1.asp"
> <title>Eoin's first Page</title></head>
>
>
> <body bgcolor="#0000a0" text="#ffffff">
>
>
> <a href="http://apcintern03/EoinASP/"
> ><FONT color=white
> >PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
> </FONT>
>
>
>
>
>
>
> <table BORDER="4" ALIGN="center" CELLPADDING="5"
> COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
> <colgroup>
> <col ALIGN="middle">
> <col ALIGN="middle">
> <col ALIGN="middle">
> </colgroup>
> <caption ALIGN="top"><big><u>Employee Database</u></big>
> </caption><BR>
> <thead>
> <TR>
> <th>ID Number
> <th>Employee Name</th>
> <th>Extension No</th>
> <th>Mentor ID</th>
> <th>Salary Level</th>
> <th>Team ID</th></TR>
> </thead>
> <TBODY>
> <tr></tr>
> <tbody>
>
>
>
>
> <%
>
> Dim Conn, selectSQL, RecSet
>
>
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.Open "Driver={SQL
> Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=Ex
> ampleDB;"
>
> selectSQL = "SELECT * FROM Employee"
> Set RecSet = Conn.Execute (selectSQL)
> If NOT RecSet.EOF THEN
>
> DO UNTIL RecSet.EOF
> Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>"
> & "<TD>" &
> RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo") & "</TD>"
> & "<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" &
> RecSet("SalaryLevel")
> & "</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
> RecSet.MoveNext
> Loop
>
> End If
>
> RecSet.Close
> Set RecSet = Nothing
>
> %>
>
>
>
>
>
> </tbody>
> <br><br>
>
> <b><u>Fill in Form in order to Submit New Employee to Employee
> Database</u></b><br>
>
>
>
>
> <form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
> METHOD=get id=form1 name=form1>
> ID Number <input name="IDNumber" size="4" maxlength="4" >
> Name <input name="Name" size="35" maxlength="25" ><br><br>
> Extension No <input name="ExtensionNo" size="10" maxlength="10" >
> Mentor ID <select name="MentorID" size="1">
> <option selected> 1901
> <option> 1902
> <option> 1903
> <option> 1904
> <option> 1905
> <option> 1906
> <option> 1907
> <option> 1908</option>
> </select>
> Salary Level <select name="SalaryLevel" size="1">
> <option selected> 1
> <option> 2
> <option> 3
> <option> 4
> <option> 5</option>
> </select>
> TeamID <select name="TeamID" value="" size="1">
> <option selected
> > JT
> <option> JT2
> <option> NET
> <option> VBT
> <option> DBT
> <option> ASPT</option>
> </select><br><br>
> <input value="Submit New Employee" type="submit" id=submit1
> name=submit1>
> <input value="Reset" type="reset" name="reset">
> </form><br>
>
>
>
>
>
>
>
> <%
> Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
> strTeamID, strSQL
>
> if Request.QueryString<>"" then
> nIDNumber = Request.QueryString("IDNumber")
> strEmpName = Request.QueryString("EmpName")
> strExtensionNo = Request.QueryString("ExtensionNo")
> nMentorID = Request.QueryString("MentorID")
> nSalaryLevel = Request.QueryString("SalaryLevel")
> strTeamID = Request.QueryString("TeamID")
> end if
>
> strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
> StrQuoteReplace(strEmpName) & "','" & StrQuoteReplace(strExtensionNo)
> & "'," & nMentorID & "," & nSalaryLevel & ",'" & StrQuoteReplace
> (strTeamID) & "')"
>
> Conn.Execute(strSQL)
>
> Conn.Close
> set Conn = nothing
>
>
> Function StrQuoteReplace(strValue)
> StrQuoteReplace = Replace(strValue, "'", "''")
> End Function
>
> %>
>
>
> </table>
> </body>
> </html>
>
>
>
>
>
>
>
>
> _____________________________________________________________________
> This message has been checked for all known viruses by Star Internet
> delivered through the MessageLabs Virus Scanning Service on behalf of
> Kingfield Heath Ltd. For further information visit
> http://www.star.net.uk/stats.asp
>
>
> _____________________________________________________________________
> This message has been checked for all known viruses by Star Internet
> delivered through the MessageLabs Virus Scanning Service on behalf of
> Kingfield Heath Ltd. For further information visit
> http://www.star.net.uk/stats.asp
>
>
>
Message #2 by "Peter Foti (PeterF)" <PeterF@S...> on Mon, 15 Apr 2002 15:43:32 -0400
|
|
It's the "Name" input form. Needs to be "EmpName". :)
Pete
> -----Original Message-----
> From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
> Sent: Monday, April 15, 2002 3:37 PM
> To: ASP Databases
> Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
> ntax near ',' - line 137
>
>
> Still no good. Same error again
>
> -----Original Message-----
> From: Peter Foti (PeterF) [mailto:PeterF@S...]
> Sent: Monday, April 15, 2002 3:14 PM
> To: ASP Databases
> Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
> ntax near ',' - line 137
>
>
> Your MentorID, SalaryLevel, and TeamID options do not have any values
> associated with them. I think this is the cause of your
> problem. When
> you are submitting the form, these inputs essentially have no value.
> Try doing something like this:
>
> Mentor ID <select name="MentorID" size="1">
> <option value="1901" selected> 1901
> <option value="1902"> 1902
> <option value="1903"> 1903
> <option value="1904"> 1904
> <option value="1905"> 1905
> <option value="1906"> 1906
> <option value="1907"> 1907
> <option value="1908"> 1908</option>
> </select>
>
> Do this for each of your select boxes.
> Regards,
> Pete
>
>
> > -----Original Message-----
> > From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
> > Sent: Monday, April 15, 2002 10:58 AM
> > To: ASP Databases
> > Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
> > ntax near ',' - line 137
> >
> >
> > <%Option Explicit%>
> >
> > <html>
> > <head>
> > META http-equiv=3D"Refresh" content=3D"15";
> > url=3D"http://apcintern03/Eoinasp/page1.asp"
> > <title>Eoin's first Page</title></head>
> >
> >
> > <body bgcolor="#0000a0" text="#ffffff">
> >
> >
> > <a href="http://apcintern03/EoinASP/"
> > ><FONT color=white
> > >PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR:
> mediumblue">
> > </FONT>
> >
> >
> >
> >
> >
> >
> > <table BORDER="4" ALIGN="center" CELLPADDING="5"
> > COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
> > <colgroup>
> > <col ALIGN="middle">
> > <col ALIGN="middle">
> > <col ALIGN="middle">
> > </colgroup>
> > <caption ALIGN="top"><big><u>Employee Database</u></big>
> > </caption><BR>
> > <thead>
> > <TR>
> > <th>ID Number
> > <th>Employee Name</th>
> > <th>Extension No</th>
> > <th>Mentor ID</th>
> > <th>Salary Level</th>
> > <th>Team ID</th></TR>
> > </thead>
> > <TBODY>
> > <tr></tr>
> > <tbody>
> >
> >
> >
> >
> > <%
> >
> > Dim Conn, selectSQL, RecSet
> >
> >
> > Set Conn = Server.CreateObject("ADODB.Connection")
> > Conn.Open "Driver={SQL
> > Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=Ex
> > ampleDB;"
> >
> > selectSQL = "SELECT * FROM Employee"
> > Set RecSet = Conn.Execute (selectSQL)
> > If NOT RecSet.EOF THEN
> >
> > DO UNTIL RecSet.EOF
> > Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>"
> > & "<TD>" &
> > RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo")
> > & "</TD>" &
> > "<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" &
> > RecSet("SalaryLevel") &
> > "</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
> > RecSet.MoveNext
> > Loop
> >
> > End If
> >
> > RecSet.Close
> > Set RecSet = Nothing
> >
> > %>
> >
> >
> >
> >
> >
> > </tbody>
> > <br><br>
> >
> > <b><u>Fill in Form in order to Submit New Employee to Employee
> > Database</u></b><br>
> >
> >
> >
> >
> > <form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
> > METHOD=get id=form1 name=form1>
> > ID Number <input name="IDNumber" size="4" maxlength="4" >
> > Name <input name="Name" size="35" maxlength="25" ><br><br>
> > Extension No <input name="ExtensionNo" size="10" maxlength="10" >
> > Mentor ID <select name="MentorID" size="1">
> > <option selected> 1901
> > <option> 1902
> > <option> 1903
> > <option> 1904
> > <option> 1905
> > <option> 1906
> > <option> 1907
> > <option> 1908</option>
> > </select>
> > Salary Level <select name="SalaryLevel" size="1">
> > <option selected> 1
> > <option> 2
> > <option> 3
> > <option> 4
> > <option> 5</option>
> > </select>
> > TeamID <select name="TeamID" value="" size="1">
> > <option selected
> > > JT
> > <option> JT2
> > <option> NET
> > <option> VBT
> > <option> DBT
> > <option> ASPT</option>
> > </select><br><br>
> > <input value="Submit New Employee" type="submit" id=submit1
> > name=submit1>
> > <input value="Reset" type="reset" name="reset">
> > </form><br>
> >
> >
> >
> >
> >
> >
> >
> > <%
> > Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
> > strTeamID, strSQL
> >
> > if Request.QueryString<>"" then
> > nIDNumber = Request.QueryString("IDNumber")
> > strEmpName = Request.QueryString("EmpName")
> > strExtensionNo = Request.QueryString("ExtensionNo")
> > nMentorID = Request.QueryString("MentorID")
> > nSalaryLevel = Request.QueryString("SalaryLevel")
> > strTeamID = Request.QueryString("TeamID")
> > end if
> >
> > strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
> > StrQuoteReplace(strEmpName) & "','" &
> > StrQuoteReplace(strExtensionNo) & "',"
> > & nMentorID & "," & nSalaryLevel & ",'" &
> > StrQuoteReplace(strTeamID) & "')"
> >
> > Response.Write(strSQL)
> >
> > Conn.Execute(strSQL)
> >
> > Conn.Close
> > set Conn = nothing
> >
> >
> > Function StrQuoteReplace(strValue)
> > StrQuoteReplace = Replace(strValue, "'", "''")
> > End Function
> >
> > %>
> >
> >
> > </table>
> > </body>
> > </html>
> >
> >
> >
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: Craig Flannigan [mailto:ckf@k...]
> > Sent: Monday, April 15, 2002 10:33 AM
> > To: ASP Databases
> > Subject: [asp_databases] RE: HELP!!!!! 80040E14 error -
> > Incorrect syntax
> > near ',' - line 137
> >
> >
> > It means that an error has occurred near one of your commas
> > in your SQL
> > code.
> >
> > Check that users are not putting ' marks in the boxes. If
> > their name has
> > apostrophes in it, then it will cause your SQL to fail.
> >
> > To get around this, use the replace command.
> >
> > strName = Replace(Request.form("Name"),"'","''")
> >
> > strName is now inserted into the SQL string instead of
> > Request.form("Name")
> >
> >
> >
> > HTH
> > Craig.
> >
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: Eoin Hayes [mailto:Hayes_Eoin@e...]
> > Sent: 15 April 2002 15:30
> > To: ASP Databases
> > Subject: [asp_databases] HELP!!!!! 80040E14 error - Incorrect syntax
> > near ',' - line 137
> >
> >
> > I keep getting this 80040E14 error when I try to get the page
> > up. The page
> > contains textboxes where the user can enter employee
> details and then
> > submit them to enter a new employee to an employee database
> > in SQL Server.
> > The error indicates to line 137 i.e. Conn.Execute (strSQL)
> > What is incorrect syntax near ',' all about???
> >
> > Here is my code:
> >
> > <%Option Explicit%>
> >
> > <html>
> > <head>
> > META http-equiv=3D"Refresh" content=3D"15";
> > url=3D"http://apcintern03/Eoinasp/page1.asp"
> > <title>Eoin's first Page</title></head>
> >
> >
> > <body bgcolor="#0000a0" text="#ffffff">
> >
> >
> > <a href="http://apcintern03/EoinASP/"
> > ><FONT color=white
> > >PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR:
> mediumblue">
> > </FONT>
> >
> >
> >
> >
> >
> >
> > <table BORDER="4" ALIGN="center" CELLPADDING="5"
> > COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
> > <colgroup>
> > <col ALIGN="middle">
> > <col ALIGN="middle">
> > <col ALIGN="middle">
> > </colgroup>
> > <caption ALIGN="top"><big><u>Employee Database</u></big>
> > </caption><BR>
> > <thead>
> > <TR>
> > <th>ID Number
> > <th>Employee Name</th>
> > <th>Extension No</th>
> > <th>Mentor ID</th>
> > <th>Salary Level</th>
> > <th>Team ID</th></TR>
> > </thead>
> > <TBODY>
> > <tr></tr>
> > <tbody>
> >
> >
> >
> >
> > <%
> >
> > Dim Conn, selectSQL, RecSet
> >
> >
> > Set Conn = Server.CreateObject("ADODB.Connection")
> > Conn.Open "Driver={SQL
> > Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=Ex
> > ampleDB;"
> >
> > selectSQL = "SELECT * FROM Employee"
> > Set RecSet = Conn.Execute (selectSQL)
> > If NOT RecSet.EOF THEN
> >
> > DO UNTIL RecSet.EOF
> > Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>"
> > & "<TD>" &
> > RecSet("EmpName") & "</TD>" & "<TD>" &
> RecSet("ExtensionNo") & "</TD>"
> > & "<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" &
> > RecSet("SalaryLevel")
> > & "</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
> > RecSet.MoveNext
> > Loop
> >
> > End If
> >
> > RecSet.Close
> > Set RecSet = Nothing
> >
> > %>
> >
> >
> >
> >
> >
> > </tbody>
> > <br><br>
> >
> > <b><u>Fill in Form in order to Submit New Employee to Employee
> > Database</u></b><br>
> >
> >
> >
> >
> > <form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
> > METHOD=get id=form1 name=form1>
> > ID Number <input name="IDNumber" size="4" maxlength="4" >
> > Name <input name="Name" size="35" maxlength="25" ><br><br>
> > Extension No <input name="ExtensionNo" size="10" maxlength="10" >
> > Mentor ID <select name="MentorID" size="1">
> > <option selected> 1901
> > <option> 1902
> > <option> 1903
> > <option> 1904
> > <option> 1905
> > <option> 1906
> > <option> 1907
> > <option> 1908</option>
> > </select>
> > Salary Level <select name="SalaryLevel" size="1">
> > <option selected> 1
> > <option> 2
> > <option> 3
> > <option> 4
> > <option> 5</option>
> > </select>
> > TeamID <select name="TeamID" value="" size="1">
> > <option selected
> > > JT
> > <option> JT2
> > <option> NET
> > <option> VBT
> > <option> DBT
> > <option> ASPT</option>
> > </select><br><br>
> > <input value="Submit New Employee" type="submit" id=submit1
> > name=submit1>
> > <input value="Reset" type="reset" name="reset">
> > </form><br>
> >
> >
> >
> >
> >
> >
> >
> > <%
> > Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
> > strTeamID, strSQL
> >
> > if Request.QueryString<>"" then
> > nIDNumber = Request.QueryString("IDNumber")
> > strEmpName = Request.QueryString("EmpName")
> > strExtensionNo = Request.QueryString("ExtensionNo")
> > nMentorID = Request.QueryString("MentorID")
> > nSalaryLevel = Request.QueryString("SalaryLevel")
> > strTeamID = Request.QueryString("TeamID")
> > end if
> >
> > strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
> > StrQuoteReplace(strEmpName) & "','" &
> StrQuoteReplace(strExtensionNo)
> > & "'," & nMentorID & "," & nSalaryLevel & ",'" & StrQuoteReplace
> > (strTeamID) & "')"
> >
> > Conn.Execute(strSQL)
> >
> > Conn.Close
> > set Conn = nothing
> >
> >
> > Function StrQuoteReplace(strValue)
> > StrQuoteReplace = Replace(strValue, "'", "''")
> > End Function
> >
> > %>
> >
> >
> > </table>
> > </body>
> > </html>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> _____________________________________________________________________
> > This message has been checked for all known viruses by Star Internet
> > delivered through the MessageLabs Virus Scanning Service on
> behalf of
> > Kingfield Heath Ltd. For further information visit
> > http://www.star.net.uk/stats.asp
> >
> >
> >
> _____________________________________________________________________
> > This message has been checked for all known viruses by Star Internet
> > delivered through the MessageLabs Virus Scanning Service on
> behalf of
> > Kingfield Heath Ltd. For further information visit
> > http://www.star.net.uk/stats.asp
> >
> >
> >
>
>
>
Message #3 by "Peter Foti (PeterF)" <PeterF@S...> on Mon, 15 Apr 2002 15:14:24 -0400
|
|
Your MentorID, SalaryLevel, and TeamID options do not have any values
associated with them. I think this is the cause of your problem. When
you are submitting the form, these inputs essentially have no value.
Try doing something like this:
Mentor ID <select name="MentorID" size="1">
<option value="1901" selected> 1901
<option value="1902"> 1902
<option value="1903"> 1903
<option value="1904"> 1904
<option value="1905"> 1905
<option value="1906"> 1906
<option value="1907"> 1907
<option value="1908"> 1908</option>
</select>
Do this for each of your select boxes.
Regards,
Pete
> -----Original Message-----
> From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
> Sent: Monday, April 15, 2002 10:58 AM
> To: ASP Databases
> Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
> ntax near ',' - line 137
>
>
> <%Option Explicit%>
>
> <html>
> <head>
> META http-equiv=3D"Refresh" content=3D"15";
> url=3D"http://apcintern03/Eoinasp/page1.asp"
> <title>Eoin's first Page</title></head>
>
>
> <body bgcolor="#0000a0" text="#ffffff">
>
>
> <a href="http://apcintern03/EoinASP/"
> ><FONT color=white
> >PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
> </FONT>
>
>
>
>
>
>
> <table BORDER="4" ALIGN="center" CELLPADDING="5"
> COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
> <colgroup>
> <col ALIGN="middle">
> <col ALIGN="middle">
> <col ALIGN="middle">
> </colgroup>
> <caption ALIGN="top"><big><u>Employee Database</u></big>
> </caption><BR>
> <thead>
> <TR>
> <th>ID Number
> <th>Employee Name</th>
> <th>Extension No</th>
> <th>Mentor ID</th>
> <th>Salary Level</th>
> <th>Team ID</th></TR>
> </thead>
> <TBODY>
> <tr></tr>
> <tbody>
>
>
>
>
> <%
>
> Dim Conn, selectSQL, RecSet
>
>
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.Open "Driver={SQL
> Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=Ex
> ampleDB;"
>
> selectSQL = "SELECT * FROM Employee"
> Set RecSet = Conn.Execute (selectSQL)
> If NOT RecSet.EOF THEN
>
> DO UNTIL RecSet.EOF
> Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>"
> & "<TD>" &
> RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo")
> & "</TD>" &
> "<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" &
> RecSet("SalaryLevel") &
> "</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
> RecSet.MoveNext
> Loop
>
> End If
>
> RecSet.Close
> Set RecSet = Nothing
>
> %>
>
>
>
>
>
> </tbody>
> <br><br>
>
> <b><u>Fill in Form in order to Submit New Employee to Employee
> Database</u></b><br>
>
>
>
>
> <form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
> METHOD=get id=form1 name=form1>
> ID Number <input name="IDNumber" size="4" maxlength="4" >
> Name <input name="Name" size="35" maxlength="25" ><br><br>
> Extension No <input name="ExtensionNo" size="10" maxlength="10" >
> Mentor ID <select name="MentorID" size="1">
> <option selected> 1901
> <option> 1902
> <option> 1903
> <option> 1904
> <option> 1905
> <option> 1906
> <option> 1907
> <option> 1908</option>
> </select>
> Salary Level <select name="SalaryLevel" size="1">
> <option selected> 1
> <option> 2
> <option> 3
> <option> 4
> <option> 5</option>
> </select>
> TeamID <select name="TeamID" value="" size="1">
> <option selected
> > JT
> <option> JT2
> <option> NET
> <option> VBT
> <option> DBT
> <option> ASPT</option>
> </select><br><br>
> <input value="Submit New Employee" type="submit" id=submit1
> name=submit1>
> <input value="Reset" type="reset" name="reset">
> </form><br>
>
>
>
>
>
>
>
> <%
> Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
> strTeamID, strSQL
>
> if Request.QueryString<>"" then
> nIDNumber = Request.QueryString("IDNumber")
> strEmpName = Request.QueryString("EmpName")
> strExtensionNo = Request.QueryString("ExtensionNo")
> nMentorID = Request.QueryString("MentorID")
> nSalaryLevel = Request.QueryString("SalaryLevel")
> strTeamID = Request.QueryString("TeamID")
> end if
>
> strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
> StrQuoteReplace(strEmpName) & "','" &
> StrQuoteReplace(strExtensionNo) & "',"
> & nMentorID & "," & nSalaryLevel & ",'" &
> StrQuoteReplace(strTeamID) & "')"
>
> Response.Write(strSQL)
>
> Conn.Execute(strSQL)
>
> Conn.Close
> set Conn = nothing
>
>
> Function StrQuoteReplace(strValue)
> StrQuoteReplace = Replace(strValue, "'", "''")
> End Function
>
> %>
>
>
> </table>
> </body>
> </html>
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: Craig Flannigan [mailto:ckf@k...]
> Sent: Monday, April 15, 2002 10:33 AM
> To: ASP Databases
> Subject: [asp_databases] RE: HELP!!!!! 80040E14 error -
> Incorrect syntax
> near ',' - line 137
>
>
> It means that an error has occurred near one of your commas
> in your SQL
> code.
>
> Check that users are not putting ' marks in the boxes. If
> their name has
> apostrophes in it, then it will cause your SQL to fail.
>
> To get around this, use the replace command.
>
> strName = Replace(Request.form("Name"),"'","''")
>
> strName is now inserted into the SQL string instead of
> Request.form("Name")
>
>
>
> HTH
> Craig.
>
>
>
>
>
>
> -----Original Message-----
> From: Eoin Hayes [mailto:Hayes_Eoin@e...]
> Sent: 15 April 2002 15:30
> To: ASP Databases
> Subject: [asp_databases] HELP!!!!! 80040E14 error - Incorrect syntax
> near ',' - line 137
>
>
> I keep getting this 80040E14 error when I try to get the page
> up. The page
> contains textboxes where the user can enter employee details and then
> submit them to enter a new employee to an employee database
> in SQL Server.
> The error indicates to line 137 i.e. Conn.Execute (strSQL)
> What is incorrect syntax near ',' all about???
>
> Here is my code:
>
> <%Option Explicit%>
>
> <html>
> <head>
> META http-equiv=3D"Refresh" content=3D"15";
> url=3D"http://apcintern03/Eoinasp/page1.asp"
> <title>Eoin's first Page</title></head>
>
>
> <body bgcolor="#0000a0" text="#ffffff">
>
>
> <a href="http://apcintern03/EoinASP/"
> ><FONT color=white
> >PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
> </FONT>
>
>
>
>
>
>
> <table BORDER="4" ALIGN="center" CELLPADDING="5"
> COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
> <colgroup>
> <col ALIGN="middle">
> <col ALIGN="middle">
> <col ALIGN="middle">
> </colgroup>
> <caption ALIGN="top"><big><u>Employee Database</u></big>
> </caption><BR>
> <thead>
> <TR>
> <th>ID Number
> <th>Employee Name</th>
> <th>Extension No</th>
> <th>Mentor ID</th>
> <th>Salary Level</th>
> <th>Team ID</th></TR>
> </thead>
> <TBODY>
> <tr></tr>
> <tbody>
>
>
>
>
> <%
>
> Dim Conn, selectSQL, RecSet
>
>
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.Open "Driver={SQL
> Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=Ex
> ampleDB;"
>
> selectSQL = "SELECT * FROM Employee"
> Set RecSet = Conn.Execute (selectSQL)
> If NOT RecSet.EOF THEN
>
> DO UNTIL RecSet.EOF
> Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>"
> & "<TD>" &
> RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo") & "</TD>"
> & "<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" &
> RecSet("SalaryLevel")
> & "</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
> RecSet.MoveNext
> Loop
>
> End If
>
> RecSet.Close
> Set RecSet = Nothing
>
> %>
>
>
>
>
>
> </tbody>
> <br><br>
>
> <b><u>Fill in Form in order to Submit New Employee to Employee
> Database</u></b><br>
>
>
>
>
> <form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
> METHOD=get id=form1 name=form1>
> ID Number <input name="IDNumber" size="4" maxlength="4" >
> Name <input name="Name" size="35" maxlength="25" ><br><br>
> Extension No <input name="ExtensionNo" size="10" maxlength="10" >
> Mentor ID <select name="MentorID" size="1">
> <option selected> 1901
> <option> 1902
> <option> 1903
> <option> 1904
> <option> 1905
> <option> 1906
> <option> 1907
> <option> 1908</option>
> </select>
> Salary Level <select name="SalaryLevel" size="1">
> <option selected> 1
> <option> 2
> <option> 3
> <option> 4
> <option> 5</option>
> </select>
> TeamID <select name="TeamID" value="" size="1">
> <option selected
> > JT
> <option> JT2
> <option> NET
> <option> VBT
> <option> DBT
> <option> ASPT</option>
> </select><br><br>
> <input value="Submit New Employee" type="submit" id=submit1
> name=submit1>
> <input value="Reset" type="reset" name="reset">
> </form><br>
>
>
>
>
>
>
>
> <%
> Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
> strTeamID, strSQL
>
> if Request.QueryString<>"" then
> nIDNumber = Request.QueryString("IDNumber")
> strEmpName = Request.QueryString("EmpName")
> strExtensionNo = Request.QueryString("ExtensionNo")
> nMentorID = Request.QueryString("MentorID")
> nSalaryLevel = Request.QueryString("SalaryLevel")
> strTeamID = Request.QueryString("TeamID")
> end if
>
> strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
> StrQuoteReplace(strEmpName) & "','" & StrQuoteReplace(strExtensionNo)
> & "'," & nMentorID & "," & nSalaryLevel & ",'" & StrQuoteReplace
> (strTeamID) & "')"
>
> Conn.Execute(strSQL)
>
> Conn.Close
> set Conn = nothing
>
>
> Function StrQuoteReplace(strValue)
> StrQuoteReplace = Replace(strValue, "'", "''")
> End Function
>
> %>
>
>
> </table>
> </body>
> </html>
>
>
>
>
>
>
>
>
> _____________________________________________________________________
> This message has been checked for all known viruses by Star Internet
> delivered through the MessageLabs Virus Scanning Service on behalf of
> Kingfield Heath Ltd. For further information visit
> http://www.star.net.uk/stats.asp
>
>
> _____________________________________________________________________
> This message has been checked for all known viruses by Star Internet
> delivered through the MessageLabs Virus Scanning Service on behalf of
> Kingfield Heath Ltd. For further information visit
> http://www.star.net.uk/stats.asp
>
>
>
Message #4 by "Craig Flannigan" <ckf@k...> on Mon, 15 Apr 2002 16:26:40 +0100
|
|
Is all the code on one page, or is the insert code on it's own page?
-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 16:24
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
You see I can't even get the page up.
It only is visible when I remove the Conn.Execute(strSQL) line. If I remove
the line and get the page up and then fill in the text boxes and then go
back to my code, put the line back in and save, and then go back to the page
and submit the data is actually entered into the DB
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 11:14 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
If this is the result, then nothing is getting entered.
Are any of your fields set to "Required" in the table design?
No values from your form are getting to the SQL
-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 16:07
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
I get this INSERT INTO Employee (IDNumber, EmpName, ExtensionNO, MentorID,
SalaryLevel, TeamID) VALUES (,'','',,,'')
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 11:03 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
You need to run this ASP page again, rather than posting the code listing
again.
Run the page, you'll get the same error again, but it should write the SQL
code with the values filled in onto the screen. It's that part I need to see
where the commas missing.
-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 15:58
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
<%Option Explicit%>
<html>
<head>
META http-equiv=3D"Refresh" content=3D"15";
url=3D"http://apcintern03/Eoinasp/page1.asp"
<title>Eoin's first Page</title></head>
<body bgcolor="#0000a0" text="#ffffff">
<a href="http://apcintern03/EoinASP/"
><FONT color=white
>PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
</FONT>
<table BORDER="4" ALIGN="center" CELLPADDING="5"
COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
<colgroup>
<col ALIGN="middle">
<col ALIGN="middle">
<col ALIGN="middle">
</colgroup>
<caption ALIGN="top"><big><u>Employee Database</u></big>
</caption><BR>
<thead>
<TR>
<th>ID Number
<th>Employee Name</th>
<th>Extension No</th>
<th>Mentor ID</th>
<th>Salary Level</th>
<th>Team ID</th></TR>
</thead>
<TBODY>
<tr></tr>
<tbody>
<%
Dim Conn, selectSQL, RecSet
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL
Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=ExampleDB;"
selectSQL = "SELECT * FROM Employee"
Set RecSet = Conn.Execute (selectSQL)
If NOT RecSet.EOF THEN
DO UNTIL RecSet.EOF
Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>" & "<TD>" &
RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo") & "</TD>" &
"<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" & RecSet("SalaryLevel") &
"</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
RecSet.MoveNext
Loop
End If
RecSet.Close
Set RecSet = Nothing
%>
</tbody>
<br><br>
<b><u>Fill in Form in order to Submit New Employee to Employee
Database</u></b><br>
<form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
METHOD=get id=form1 name=form1>
ID Number <input name="IDNumber" size="4" maxlength="4" >
Name <input name="Name" size="35" maxlength="25" ><br><br>
Extension No <input name="ExtensionNo" size="10" maxlength="10" >
Mentor ID <select name="MentorID" size="1">
<option selected> 1901
<option> 1902
<option> 1903
<option> 1904
<option> 1905
<option> 1906
<option> 1907
<option> 1908</option>
</select>
Salary Level <select name="SalaryLevel" size="1">
<option selected> 1
<option> 2
<option> 3
<option> 4
<option> 5</option>
</select>
TeamID <select name="TeamID" value="" size="1">
<option selected
> JT
<option> JT2
<option> NET
<option> VBT
<option> DBT
<option> ASPT</option>
</select><br><br>
<input value="Submit New Employee" type="submit" id=submit1 name=submit1>
<input value="Reset" type="reset" name="reset">
</form><br>
<%
Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
strTeamID, strSQL
if Request.QueryString<>"" then
nIDNumber = Request.QueryString("IDNumber")
strEmpName = Request.QueryString("EmpName")
strExtensionNo = Request.QueryString("ExtensionNo")
nMentorID = Request.QueryString("MentorID")
nSalaryLevel = Request.QueryString("SalaryLevel")
strTeamID = Request.QueryString("TeamID")
end if
strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
StrQuoteReplace(strEmpName) & "','" & StrQuoteReplace(strExtensionNo) & "',"
& nMentorID & "," & nSalaryLevel & ",'" & StrQuoteReplace(strTeamID) & "')"
Response.Write(strSQL)
Conn.Execute(strSQL)
Conn.Close
set Conn = nothing
Function StrQuoteReplace(strValue)
StrQuoteReplace = Replace(strValue, "'", "''")
End Function
%>
</table>
</body>
</html>
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 10:33 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect syntax
near ',' - line 137
It means that an error has occurred near one of your commas in your SQL
code.
Check that users are not putting ' marks in the boxes. If their name has
apostrophes in it, then it will cause your SQL to fail.
To get around this, use the replace command.
strName = Replace(Request.form("Name"),"'","''")
strName is now inserted into the SQL string instead of Request.form("Name")
HTH
Craig.
-----Original Message-----
From: Eoin Hayes [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 15:30
To: ASP Databases
Subject: [asp_databases] HELP!!!!! 80040E14 error - Incorrect syntax
near ',' - line 137
I keep getting this 80040E14 error when I try to get the page up. The page
contains textboxes where the user can enter employee details and then
submit them to enter a new employee to an employee database in SQL Server.
The error indicates to line 137 i.e. Conn.Execute (strSQL)
What is incorrect syntax near ',' all about???
Here is my code:
<%Option Explicit%>
<html>
<head>
META http-equiv=3D"Refresh" content=3D"15";
url=3D"http://apcintern03/Eoinasp/page1.asp"
<title>Eoin's first Page</title></head>
<body bgcolor="#0000a0" text="#ffffff">
<a href="http://apcintern03/EoinASP/"
><FONT color=white
>PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
</FONT>
<table BORDER="4" ALIGN="center" CELLPADDING="5"
COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
<colgroup>
<col ALIGN="middle">
<col ALIGN="middle">
<col ALIGN="middle">
</colgroup>
<caption ALIGN="top"><big><u>Employee Database</u></big>
</caption><BR>
<thead>
<TR>
<th>ID Number
<th>Employee Name</th>
<th>Extension No</th>
<th>Mentor ID</th>
<th>Salary Level</th>
<th>Team ID</th></TR>
</thead>
<TBODY>
<tr></tr>
<tbody>
<%
Dim Conn, selectSQL, RecSet
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL
Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=ExampleDB;"
selectSQL = "SELECT * FROM Employee"
Set RecSet = Conn.Execute (selectSQL)
If NOT RecSet.EOF THEN
DO UNTIL RecSet.EOF
Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>" & "<TD>" &
RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo") & "</TD>"
& "<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" & RecSet("SalaryLevel")
& "</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
RecSet.MoveNext
Loop
End If
RecSet.Close
Set RecSet = Nothing
%>
</tbody>
<br><br>
<b><u>Fill in Form in order to Submit New Employee to Employee
Database</u></b><br>
<form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
METHOD=get id=form1 name=form1>
ID Number <input name="IDNumber" size="4" maxlength="4" >
Name <input name="Name" size="35" maxlength="25" ><br><br>
Extension No <input name="ExtensionNo" size="10" maxlength="10" >
Mentor ID <select name="MentorID" size="1">
<option selected> 1901
<option> 1902
<option> 1903
<option> 1904
<option> 1905
<option> 1906
<option> 1907
<option> 1908</option>
</select>
Salary Level <select name="SalaryLevel" size="1">
<option selected> 1
<option> 2
<option> 3
<option> 4
<option> 5</option>
</select>
TeamID <select name="TeamID" value="" size="1">
<option selected
> JT
<option> JT2
<option> NET
<option> VBT
<option> DBT
<option> ASPT</option>
</select><br><br>
<input value="Submit New Employee" type="submit" id=submit1 name=submit1>
<input value="Reset" type="reset" name="reset">
</form><br>
<%
Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
strTeamID, strSQL
if Request.QueryString<>"" then
nIDNumber = Request.QueryString("IDNumber")
strEmpName = Request.QueryString("EmpName")
strExtensionNo = Request.QueryString("ExtensionNo")
nMentorID = Request.QueryString("MentorID")
nSalaryLevel = Request.QueryString("SalaryLevel")
strTeamID = Request.QueryString("TeamID")
end if
strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
StrQuoteReplace(strEmpName) & "','" & StrQuoteReplace(strExtensionNo)
& "'," & nMentorID & "," & nSalaryLevel & ",'" & StrQuoteReplace
(strTeamID) & "')"
Conn.Execute(strSQL)
Conn.Close
set Conn = nothing
Function StrQuoteReplace(strValue)
StrQuoteReplace = Replace(strValue, "'", "''")
End Function
%>
</table>
</body>
</html>
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
Message #5 by Hayes_Eoin@e... on Mon, 15 Apr 2002 11:31:36 -0400
|
|
All on one page. The page has text boxes and a submit and reset button.
Also on the page is a table, which shows the DB table entries. Hence I want
the table on the page to be updated as the user enters new values to the DB
via the text boxes and Submit button.
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 11:27 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
Is all the code on one page, or is the insert code on it's own page?
-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 16:24
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
You see I can't even get the page up.
It only is visible when I remove the Conn.Execute(strSQL) line. If I remove
the line and get the page up and then fill in the text boxes and then go
back to my code, put the line back in and save, and then go back to the page
and submit the data is actually entered into the DB
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 11:14 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
If this is the result, then nothing is getting entered.
Are any of your fields set to "Required" in the table design?
No values from your form are getting to the SQL
-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 16:07
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
I get this INSERT INTO Employee (IDNumber, EmpName, ExtensionNO, MentorID,
SalaryLevel, TeamID) VALUES (,'','',,,'')
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 11:03 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
You need to run this ASP page again, rather than posting the code listing
again.
Run the page, you'll get the same error again, but it should write the SQL
code with the values filled in onto the screen. It's that part I need to see
where the commas missing.
-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 15:58
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
<%Option Explicit%>
<html>
<head>
META http-equiv=3D"Refresh" content=3D"15";
url=3D"http://apcintern03/Eoinasp/page1.asp"
<title>Eoin's first Page</title></head>
<body bgcolor="#0000a0" text="#ffffff">
<a href="http://apcintern03/EoinASP/"
><FONT color=white
>PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
</FONT>
<table BORDER="4" ALIGN="center" CELLPADDING="5"
COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
<colgroup>
<col ALIGN="middle">
<col ALIGN="middle">
<col ALIGN="middle">
</colgroup>
<caption ALIGN="top"><big><u>Employee Database</u></big>
</caption><BR>
<thead>
<TR>
<th>ID Number
<th>Employee Name</th>
<th>Extension No</th>
<th>Mentor ID</th>
<th>Salary Level</th>
<th>Team ID</th></TR>
</thead>
<TBODY>
<tr></tr>
<tbody>
<%
Dim Conn, selectSQL, RecSet
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL
Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=ExampleDB;"
selectSQL = "SELECT * FROM Employee"
Set RecSet = Conn.Execute (selectSQL)
If NOT RecSet.EOF THEN
DO UNTIL RecSet.EOF
Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>" & "<TD>" &
RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo") & "</TD>" &
"<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" & RecSet("SalaryLevel") &
"</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
RecSet.MoveNext
Loop
End If
RecSet.Close
Set RecSet = Nothing
%>
</tbody>
<br><br>
<b><u>Fill in Form in order to Submit New Employee to Employee
Database</u></b><br>
<form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
METHOD=get id=form1 name=form1>
ID Number <input name="IDNumber" size="4" maxlength="4" >
Name <input name="Name" size="35" maxlength="25" ><br><br>
Extension No <input name="ExtensionNo" size="10" maxlength="10" >
Mentor ID <select name="MentorID" size="1">
<option selected> 1901
<option> 1902
<option> 1903
<option> 1904
<option> 1905
<option> 1906
<option> 1907
<option> 1908</option>
</select>
Salary Level <select name="SalaryLevel" size="1">
<option selected> 1
<option> 2
<option> 3
<option> 4
<option> 5</option>
</select>
TeamID <select name="TeamID" value="" size="1">
<option selected
> JT
<option> JT2
<option> NET
<option> VBT
<option> DBT
<option> ASPT</option>
</select><br><br>
<input value="Submit New Employee" type="submit" id=submit1 name=submit1>
<input value="Reset" type="reset" name="reset">
</form><br>
<%
Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
strTeamID, strSQL
if Request.QueryString<>"" then
nIDNumber = Request.QueryString("IDNumber")
strEmpName = Request.QueryString("EmpName")
strExtensionNo = Request.QueryString("ExtensionNo")
nMentorID = Request.QueryString("MentorID")
nSalaryLevel = Request.QueryString("SalaryLevel")
strTeamID = Request.QueryString("TeamID")
end if
strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
StrQuoteReplace(strEmpName) & "','" & StrQuoteReplace(strExtensionNo) & "',"
& nMentorID & "," & nSalaryLevel & ",'" & StrQuoteReplace(strTeamID) & "')"
Response.Write(strSQL)
Conn.Execute(strSQL)
Conn.Close
set Conn = nothing
Function StrQuoteReplace(strValue)
StrQuoteReplace = Replace(strValue, "'", "''")
End Function
%>
</table>
</body>
</html>
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 10:33 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect syntax
near ',' - line 137
It means that an error has occurred near one of your commas in your SQL
code.
Check that users are not putting ' marks in the boxes. If their name has
apostrophes in it, then it will cause your SQL to fail.
To get around this, use the replace command.
strName = Replace(Request.form("Name"),"'","''")
strName is now inserted into the SQL string instead of Request.form("Name")
HTH
Craig.
-----Original Message-----
From: Eoin Hayes [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 15:30
To: ASP Databases
Subject: [asp_databases] HELP!!!!! 80040E14 error - Incorrect syntax
near ',' - line 137
I keep getting this 80040E14 error when I try to get the page up. The page
contains textboxes where the user can enter employee details and then
submit them to enter a new employee to an employee database in SQL Server.
The error indicates to line 137 i.e. Conn.Execute (strSQL)
What is incorrect syntax near ',' all about???
Here is my code:
<%Option Explicit%>
<html>
<head>
META http-equiv=3D"Refresh" content=3D"15";
url=3D"http://apcintern03/Eoinasp/page1.asp"
<title>Eoin's first Page</title></head>
<body bgcolor="#0000a0" text="#ffffff">
<a href="http://apcintern03/EoinASP/"
><FONT color=white
>PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
</FONT>
<table BORDER="4" ALIGN="center" CELLPADDING="5"
COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
<colgroup>
<col ALIGN="middle">
<col ALIGN="middle">
<col ALIGN="middle">
</colgroup>
<caption ALIGN="top"><big><u>Employee Database</u></big>
</caption><BR>
<thead>
<TR>
<th>ID Number
<th>Employee Name</th>
<th>Extension No</th>
<th>Mentor ID</th>
<th>Salary Level</th>
<th>Team ID</th></TR>
</thead>
<TBODY>
<tr></tr>
<tbody>
<%
Dim Conn, selectSQL, RecSet
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL
Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=ExampleDB;"
selectSQL = "SELECT * FROM Employee"
Set RecSet = Conn.Execute (selectSQL)
If NOT RecSet.EOF THEN
DO UNTIL RecSet.EOF
Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>" & "<TD>" &
RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo") & "</TD>"
& "<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" & RecSet("SalaryLevel")
& "</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
RecSet.MoveNext
Loop
End If
RecSet.Close
Set RecSet = Nothing
%>
</tbody>
<br><br>
<b><u>Fill in Form in order to Submit New Employee to Employee
Database</u></b><br>
<form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
METHOD=get id=form1 name=form1>
ID Number <input name="IDNumber" size="4" maxlength="4" >
Name <input name="Name" size="35" maxlength="25" ><br><br>
Extension No <input name="ExtensionNo" size="10" maxlength="10" >
Mentor ID <select name="MentorID" size="1">
<option selected> 1901
<option> 1902
<option> 1903
<option> 1904
<option> 1905
<option> 1906
<option> 1907
<option> 1908</option>
</select>
Salary Level <select name="SalaryLevel" size="1">
<option selected> 1
<option> 2
<option> 3
<option> 4
<option> 5</option>
</select>
TeamID <select name="TeamID" value="" size="1">
<option selected
> JT
<option> JT2
<option> NET
<option> VBT
<option> DBT
<option> ASPT</option>
</select><br><br>
<input value="Submit New Employee" type="submit" id=submit1 name=submit1>
<input value="Reset" type="reset" name="reset">
</form><br>
<%
Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
strTeamID, strSQL
if Request.QueryString<>"" then
nIDNumber = Request.QueryString("IDNumber")
strEmpName = Request.QueryString("EmpName")
strExtensionNo = Request.QueryString("ExtensionNo")
nMentorID = Request.QueryString("MentorID")
nSalaryLevel = Request.QueryString("SalaryLevel")
strTeamID = Request.QueryString("TeamID")
end if
strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
StrQuoteReplace(strEmpName) & "','" & StrQuoteReplace(strExtensionNo)
& "'," & nMentorID & "," & nSalaryLevel & ",'" & StrQuoteReplace
(strTeamID) & "')"
Conn.Execute(strSQL)
Conn.Close
set Conn = nothing
Function StrQuoteReplace(strValue)
StrQuoteReplace = Replace(strValue, "'", "''")
End Function
%>
</table>
</body>
</html>
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
Message #6 by Hayes_Eoin@e... on Mon, 15 Apr 2002 11:24:28 -0400
|
|
You see I can't even get the page up.
It only is visible when I remove the Conn.Execute(strSQL) line. If I remove
the line and get the page up and then fill in the text boxes and then go
back to my code, put the line back in and save, and then go back to the page
and submit the data is actually entered into the DB
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 11:14 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
If this is the result, then nothing is getting entered.
Are any of your fields set to "Required" in the table design?
No values from your form are getting to the SQL
-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 16:07
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
I get this INSERT INTO Employee (IDNumber, EmpName, ExtensionNO, MentorID,
SalaryLevel, TeamID) VALUES (,'','',,,'')
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 11:03 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
You need to run this ASP page again, rather than posting the code listing
again.
Run the page, you'll get the same error again, but it should write the SQL
code with the values filled in onto the screen. It's that part I need to see
where the commas missing.
-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 15:58
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
<%Option Explicit%>
<html>
<head>
META http-equiv=3D"Refresh" content=3D"15";
url=3D"http://apcintern03/Eoinasp/page1.asp"
<title>Eoin's first Page</title></head>
<body bgcolor="#0000a0" text="#ffffff">
<a href="http://apcintern03/EoinASP/"
><FONT color=white
>PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
</FONT>
<table BORDER="4" ALIGN="center" CELLPADDING="5"
COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
<colgroup>
<col ALIGN="middle">
<col ALIGN="middle">
<col ALIGN="middle">
</colgroup>
<caption ALIGN="top"><big><u>Employee Database</u></big>
</caption><BR>
<thead>
<TR>
<th>ID Number
<th>Employee Name</th>
<th>Extension No</th>
<th>Mentor ID</th>
<th>Salary Level</th>
<th>Team ID</th></TR>
</thead>
<TBODY>
<tr></tr>
<tbody>
<%
Dim Conn, selectSQL, RecSet
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL
Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=ExampleDB;"
selectSQL = "SELECT * FROM Employee"
Set RecSet = Conn.Execute (selectSQL)
If NOT RecSet.EOF THEN
DO UNTIL RecSet.EOF
Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>" & "<TD>" &
RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo") & "</TD>" &
"<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" & RecSet("SalaryLevel") &
"</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
RecSet.MoveNext
Loop
End If
RecSet.Close
Set RecSet = Nothing
%>
</tbody>
<br><br>
<b><u>Fill in Form in order to Submit New Employee to Employee
Database</u></b><br>
<form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
METHOD=get id=form1 name=form1>
ID Number <input name="IDNumber" size="4" maxlength="4" >
Name <input name="Name" size="35" maxlength="25" ><br><br>
Extension No <input name="ExtensionNo" size="10" maxlength="10" >
Mentor ID <select name="MentorID" size="1">
<option selected> 1901
<option> 1902
<option> 1903
<option> 1904
<option> 1905
<option> 1906
<option> 1907
<option> 1908</option>
</select>
Salary Level <select name="SalaryLevel" size="1">
<option selected> 1
<option> 2
<option> 3
<option> 4
<option> 5</option>
</select>
TeamID <select name="TeamID" value="" size="1">
<option selected
> JT
<option> JT2
<option> NET
<option> VBT
<option> DBT
<option> ASPT</option>
</select><br><br>
<input value="Submit New Employee" type="submit" id=submit1 name=submit1>
<input value="Reset" type="reset" name="reset">
</form><br>
<%
Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
strTeamID, strSQL
if Request.QueryString<>"" then
nIDNumber = Request.QueryString("IDNumber")
strEmpName = Request.QueryString("EmpName")
strExtensionNo = Request.QueryString("ExtensionNo")
nMentorID = Request.QueryString("MentorID")
nSalaryLevel = Request.QueryString("SalaryLevel")
strTeamID = Request.QueryString("TeamID")
end if
strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
StrQuoteReplace(strEmpName) & "','" & StrQuoteReplace(strExtensionNo) & "',"
& nMentorID & "," & nSalaryLevel & ",'" & StrQuoteReplace(strTeamID) & "')"
Response.Write(strSQL)
Conn.Execute(strSQL)
Conn.Close
set Conn = nothing
Function StrQuoteReplace(strValue)
StrQuoteReplace = Replace(strValue, "'", "''")
End Function
%>
</table>
</body>
</html>
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 10:33 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect syntax
near ',' - line 137
It means that an error has occurred near one of your commas in your SQL
code.
Check that users are not putting ' marks in the boxes. If their name has
apostrophes in it, then it will cause your SQL to fail.
To get around this, use the replace command.
strName = Replace(Request.form("Name"),"'","''")
strName is now inserted into the SQL string instead of Request.form("Name")
HTH
Craig.
-----Original Message-----
From: Eoin Hayes [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 15:30
To: ASP Databases
Subject: [asp_databases] HELP!!!!! 80040E14 error - Incorrect syntax
near ',' - line 137
I keep getting this 80040E14 error when I try to get the page up. The page
contains textboxes where the user can enter employee details and then
submit them to enter a new employee to an employee database in SQL Server.
The error indicates to line 137 i.e. Conn.Execute (strSQL)
What is incorrect syntax near ',' all about???
Here is my code:
<%Option Explicit%>
<html>
<head>
META http-equiv=3D"Refresh" content=3D"15";
url=3D"http://apcintern03/Eoinasp/page1.asp"
<title>Eoin's first Page</title></head>
<body bgcolor="#0000a0" text="#ffffff">
<a href="http://apcintern03/EoinASP/"
><FONT color=white
>PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
</FONT>
<table BORDER="4" ALIGN="center" CELLPADDING="5"
COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
<colgroup>
<col ALIGN="middle">
<col ALIGN="middle">
<col ALIGN="middle">
</colgroup>
<caption ALIGN="top"><big><u>Employee Database</u></big>
</caption><BR>
<thead>
<TR>
<th>ID Number
<th>Employee Name</th>
<th>Extension No</th>
<th>Mentor ID</th>
<th>Salary Level</th>
<th>Team ID</th></TR>
</thead>
<TBODY>
<tr></tr>
<tbody>
<%
Dim Conn, selectSQL, RecSet
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL
Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=ExampleDB;"
selectSQL = "SELECT * FROM Employee"
Set RecSet = Conn.Execute (selectSQL)
If NOT RecSet.EOF THEN
DO UNTIL RecSet.EOF
Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>" & "<TD>" &
RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo") & "</TD>"
& "<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" & RecSet("SalaryLevel")
& "</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
RecSet.MoveNext
Loop
End If
RecSet.Close
Set RecSet = Nothing
%>
</tbody>
<br><br>
<b><u>Fill in Form in order to Submit New Employee to Employee
Database</u></b><br>
<form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
METHOD=get id=form1 name=form1>
ID Number <input name="IDNumber" size="4" maxlength="4" >
Name <input name="Name" size="35" maxlength="25" ><br><br>
Extension No <input name="ExtensionNo" size="10" maxlength="10" >
Mentor ID <select name="MentorID" size="1">
<option selected> 1901
<option> 1902
<option> 1903
<option> 1904
<option> 1905
<option> 1906
<option> 1907
<option> 1908</option>
</select>
Salary Level <select name="SalaryLevel" size="1">
<option selected> 1
<option> 2
<option> 3
<option> 4
<option> 5</option>
</select>
TeamID <select name="TeamID" value="" size="1">
<option selected
> JT
<option> JT2
<option> NET
<option> VBT
<option> DBT
<option> ASPT</option>
</select><br><br>
<input value="Submit New Employee" type="submit" id=submit1 name=submit1>
<input value="Reset" type="reset" name="reset">
</form><br>
<%
Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
strTeamID, strSQL
if Request.QueryString<>"" then
nIDNumber = Request.QueryString("IDNumber")
strEmpName = Request.QueryString("EmpName")
strExtensionNo = Request.QueryString("ExtensionNo")
nMentorID = Request.QueryString("MentorID")
nSalaryLevel = Request.QueryString("SalaryLevel")
strTeamID = Request.QueryString("TeamID")
end if
strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
StrQuoteReplace(strEmpName) & "','" & StrQuoteReplace(strExtensionNo)
& "'," & nMentorID & "," & nSalaryLevel & ",'" & StrQuoteReplace
(strTeamID) & "')"
Conn.Execute(strSQL)
Conn.Close
set Conn = nothing
Function StrQuoteReplace(strValue)
StrQuoteReplace = Replace(strValue, "'", "''")
End Function
%>
</table>
</body>
</html>
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
Message #7 by Hayes_Eoin@e... on Mon, 15 Apr 2002 11:26:13 -0400
|
|
Perhaps the fact that i haven't converted values that are of type numeric in
the DB to numeric when obtained from the textboxes on the web page
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 11:14 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
If this is the result, then nothing is getting entered.
Are any of your fields set to "Required" in the table design?
No values from your form are getting to the SQL
-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 16:07
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
I get this INSERT INTO Employee (IDNumber, EmpName, ExtensionNO, MentorID,
SalaryLevel, TeamID) VALUES (,'','',,,'')
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 11:03 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
You need to run this ASP page again, rather than posting the code listing
again.
Run the page, you'll get the same error again, but it should write the SQL
code with the values filled in onto the screen. It's that part I need to see
where the commas missing.
-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 15:58
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
<%Option Explicit%>
<html>
<head>
META http-equiv=3D"Refresh" content=3D"15";
url=3D"http://apcintern03/Eoinasp/page1.asp"
<title>Eoin's first Page</title></head>
<body bgcolor="#0000a0" text="#ffffff">
<a href="http://apcintern03/EoinASP/"
><FONT color=white
>PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
</FONT>
<table BORDER="4" ALIGN="center" CELLPADDING="5"
COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
<colgroup>
<col ALIGN="middle">
<col ALIGN="middle">
<col ALIGN="middle">
</colgroup>
<caption ALIGN="top"><big><u>Employee Database</u></big>
</caption><BR>
<thead>
<TR>
<th>ID Number
<th>Employee Name</th>
<th>Extension No</th>
<th>Mentor ID</th>
<th>Salary Level</th>
<th>Team ID</th></TR>
</thead>
<TBODY>
<tr></tr>
<tbody>
<%
Dim Conn, selectSQL, RecSet
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL
Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=ExampleDB;"
selectSQL = "SELECT * FROM Employee"
Set RecSet = Conn.Execute (selectSQL)
If NOT RecSet.EOF THEN
DO UNTIL RecSet.EOF
Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>" & "<TD>" &
RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo") & "</TD>" &
"<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" & RecSet("SalaryLevel") &
"</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
RecSet.MoveNext
Loop
End If
RecSet.Close
Set RecSet = Nothing
%>
</tbody>
<br><br>
<b><u>Fill in Form in order to Submit New Employee to Employee
Database</u></b><br>
<form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
METHOD=get id=form1 name=form1>
ID Number <input name="IDNumber" size="4" maxlength="4" >
Name <input name="Name" size="35" maxlength="25" ><br><br>
Extension No <input name="ExtensionNo" size="10" maxlength="10" >
Mentor ID <select name="MentorID" size="1">
<option selected> 1901
<option> 1902
<option> 1903
<option> 1904
<option> 1905
<option> 1906
<option> 1907
<option> 1908</option>
</select>
Salary Level <select name="SalaryLevel" size="1">
<option selected> 1
<option> 2
<option> 3
<option> 4
<option> 5</option>
</select>
TeamID <select name="TeamID" value="" size="1">
<option selected
> JT
<option> JT2
<option> NET
<option> VBT
<option> DBT
<option> ASPT</option>
</select><br><br>
<input value="Submit New Employee" type="submit" id=submit1 name=submit1>
<input value="Reset" type="reset" name="reset">
</form><br>
<%
Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
strTeamID, strSQL
if Request.QueryString<>"" then
nIDNumber = Request.QueryString("IDNumber")
strEmpName = Request.QueryString("EmpName")
strExtensionNo = Request.QueryString("ExtensionNo")
nMentorID = Request.QueryString("MentorID")
nSalaryLevel = Request.QueryString("SalaryLevel")
strTeamID = Request.QueryString("TeamID")
end if
strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
StrQuoteReplace(strEmpName) & "','" & StrQuoteReplace(strExtensionNo) & "',"
& nMentorID & "," & nSalaryLevel & ",'" & StrQuoteReplace(strTeamID) & "')"
Response.Write(strSQL)
Conn.Execute(strSQL)
Conn.Close
set Conn = nothing
Function StrQuoteReplace(strValue)
StrQuoteReplace = Replace(strValue, "'", "''")
End Function
%>
</table>
</body>
</html>
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 10:33 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect syntax
near ',' - line 137
It means that an error has occurred near one of your commas in your SQL
code.
Check that users are not putting ' marks in the boxes. If their name has
apostrophes in it, then it will cause your SQL to fail.
To get around this, use the replace command.
strName = Replace(Request.form("Name"),"'","''")
strName is now inserted into the SQL string instead of Request.form("Name")
HTH
Craig.
-----Original Message-----
From: Eoin Hayes [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 15:30
To: ASP Databases
Subject: [asp_databases] HELP!!!!! 80040E14 error - Incorrect syntax
near ',' - line 137
I keep getting this 80040E14 error when I try to get the page up. The page
contains textboxes where the user can enter employee details and then
submit them to enter a new employee to an employee database in SQL Server.
The error indicates to line 137 i.e. Conn.Execute (strSQL)
What is incorrect syntax near ',' all about???
Here is my code:
<%Option Explicit%>
<html>
<head>
META http-equiv=3D"Refresh" content=3D"15";
url=3D"http://apcintern03/Eoinasp/page1.asp"
<title>Eoin's first Page</title></head>
<body bgcolor="#0000a0" text="#ffffff">
<a href="http://apcintern03/EoinASP/"
><FONT color=white
>PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
</FONT>
<table BORDER="4" ALIGN="center" CELLPADDING="5"
COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
<colgroup>
<col ALIGN="middle">
<col ALIGN="middle">
<col ALIGN="middle">
</colgroup>
<caption ALIGN="top"><big><u>Employee Database</u></big>
</caption><BR>
<thead>
<TR>
<th>ID Number
<th>Employee Name</th>
<th>Extension No</th>
<th>Mentor ID</th>
<th>Salary Level</th>
<th>Team ID</th></TR>
</thead>
<TBODY>
<tr></tr>
<tbody>
<%
Dim Conn, selectSQL, RecSet
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL
Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=ExampleDB;"
selectSQL = "SELECT * FROM Employee"
Set RecSet = Conn.Execute (selectSQL)
If NOT RecSet.EOF THEN
DO UNTIL RecSet.EOF
Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>" & "<TD>" &
RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo") & "</TD>"
& "<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" & RecSet("SalaryLevel")
& "</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
RecSet.MoveNext
Loop
End If
RecSet.Close
Set RecSet = Nothing
%>
</tbody>
<br><br>
<b><u>Fill in Form in order to Submit New Employee to Employee
Database</u></b><br>
<form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
METHOD=get id=form1 name=form1>
ID Number <input name="IDNumber" size="4" maxlength="4" >
Name <input name="Name" size="35" maxlength="25" ><br><br>
Extension No <input name="ExtensionNo" size="10" maxlength="10" >
Mentor ID <select name="MentorID" size="1">
<option selected> 1901
<option> 1902
<option> 1903
<option> 1904
<option> 1905
<option> 1906
<option> 1907
<option> 1908</option>
</select>
Salary Level <select name="SalaryLevel" size="1">
<option selected> 1
<option> 2
<option> 3
<option> 4
<option> 5</option>
</select>
TeamID <select name="TeamID" value="" size="1">
<option selected
> JT
<option> JT2
<option> NET
<option> VBT
<option> DBT
<option> ASPT</option>
</select><br><br>
<input value="Submit New Employee" type="submit" id=submit1 name=submit1>
<input value="Reset" type="reset" name="reset">
</form><br>
<%
Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
strTeamID, strSQL
if Request.QueryString<>"" then
nIDNumber = Request.QueryString("IDNumber")
strEmpName = Request.QueryString("EmpName")
strExtensionNo = Request.QueryString("ExtensionNo")
nMentorID = Request.QueryString("MentorID")
nSalaryLevel = Request.QueryString("SalaryLevel")
strTeamID = Request.QueryString("TeamID")
end if
strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
StrQuoteReplace(strEmpName) & "','" & StrQuoteReplace(strExtensionNo)
& "'," & nMentorID & "," & nSalaryLevel & ",'" & StrQuoteReplace
(strTeamID) & "')"
Conn.Execute(strSQL)
Conn.Close
set Conn = nothing
Function StrQuoteReplace(strValue)
StrQuoteReplace = Replace(strValue, "'", "''")
End Function
%>
</table>
</body>
</html>
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
Message #8 by Hayes_Eoin@e... on Mon, 15 Apr 2002 11:07:26 -0400
|
|
I get this INSERT INTO Employee (IDNumber, EmpName, ExtensionNO, MentorID,
SalaryLevel, TeamID) VALUES (,'','',,,'')
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 11:03 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
You need to run this ASP page again, rather than posting the code listing
again.
Run the page, you'll get the same error again, but it should write the SQL
code with the values filled in onto the screen. It's that part I need to see
where the commas missing.
-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 15:58
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
<%Option Explicit%>
<html>
<head>
META http-equiv=3D"Refresh" content=3D"15";
url=3D"http://apcintern03/Eoinasp/page1.asp"
<title>Eoin's first Page</title></head>
<body bgcolor="#0000a0" text="#ffffff">
<a href="http://apcintern03/EoinASP/"
><FONT color=white
>PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
</FONT>
<table BORDER="4" ALIGN="center" CELLPADDING="5"
COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
<colgroup>
<col ALIGN="middle">
<col ALIGN="middle">
<col ALIGN="middle">
</colgroup>
<caption ALIGN="top"><big><u>Employee Database</u></big>
</caption><BR>
<thead>
<TR>
<th>ID Number
<th>Employee Name</th>
<th>Extension No</th>
<th>Mentor ID</th>
<th>Salary Level</th>
<th>Team ID</th></TR>
</thead>
<TBODY>
<tr></tr>
<tbody>
<%
Dim Conn, selectSQL, RecSet
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL
Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=ExampleDB;"
selectSQL = "SELECT * FROM Employee"
Set RecSet = Conn.Execute (selectSQL)
If NOT RecSet.EOF THEN
DO UNTIL RecSet.EOF
Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>" & "<TD>" &
RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo") & "</TD>" &
"<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" & RecSet("SalaryLevel") &
"</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
RecSet.MoveNext
Loop
End If
RecSet.Close
Set RecSet = Nothing
%>
</tbody>
<br><br>
<b><u>Fill in Form in order to Submit New Employee to Employee
Database</u></b><br>
<form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
METHOD=get id=form1 name=form1>
ID Number <input name="IDNumber" size="4" maxlength="4" >
Name <input name="Name" size="35" maxlength="25" ><br><br>
Extension No <input name="ExtensionNo" size="10" maxlength="10" >
Mentor ID <select name="MentorID" size="1">
<option selected> 1901
<option> 1902
<option> 1903
<option> 1904
<option> 1905
<option> 1906
<option> 1907
<option> 1908</option>
</select>
Salary Level <select name="SalaryLevel" size="1">
<option selected> 1
<option> 2
<option> 3
<option> 4
<option> 5</option>
</select>
TeamID <select name="TeamID" value="" size="1">
<option selected
> JT
<option> JT2
<option> NET
<option> VBT
<option> DBT
<option> ASPT</option>
</select><br><br>
<input value="Submit New Employee" type="submit" id=submit1 name=submit1>
<input value="Reset" type="reset" name="reset">
</form><br>
<%
Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
strTeamID, strSQL
if Request.QueryString<>"" then
nIDNumber = Request.QueryString("IDNumber")
strEmpName = Request.QueryString("EmpName")
strExtensionNo = Request.QueryString("ExtensionNo")
nMentorID = Request.QueryString("MentorID")
nSalaryLevel = Request.QueryString("SalaryLevel")
strTeamID = Request.QueryString("TeamID")
end if
strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
StrQuoteReplace(strEmpName) & "','" & StrQuoteReplace(strExtensionNo) & "',"
& nMentorID & "," & nSalaryLevel & ",'" & StrQuoteReplace(strTeamID) & "')"
Response.Write(strSQL)
Conn.Execute(strSQL)
Conn.Close
set Conn = nothing
Function StrQuoteReplace(strValue)
StrQuoteReplace = Replace(strValue, "'", "''")
End Function
%>
</table>
</body>
</html>
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 10:33 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect syntax
near ',' - line 137
It means that an error has occurred near one of your commas in your SQL
code.
Check that users are not putting ' marks in the boxes. If their name has
apostrophes in it, then it will cause your SQL to fail.
To get around this, use the replace command.
strName = Replace(Request.form("Name"),"'","''")
strName is now inserted into the SQL string instead of Request.form("Name")
HTH
Craig.
-----Original Message-----
From: Eoin Hayes [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 15:30
To: ASP Databases
Subject: [asp_databases] HELP!!!!! 80040E14 error - Incorrect syntax
near ',' - line 137
I keep getting this 80040E14 error when I try to get the page up. The page
contains textboxes where the user can enter employee details and then
submit them to enter a new employee to an employee database in SQL Server.
The error indicates to line 137 i.e. Conn.Execute (strSQL)
What is incorrect syntax near ',' all about???
Here is my code:
<%Option Explicit%>
<html>
<head>
META http-equiv=3D"Refresh" content=3D"15";
url=3D"http://apcintern03/Eoinasp/page1.asp"
<title>Eoin's first Page</title></head>
<body bgcolor="#0000a0" text="#ffffff">
<a href="http://apcintern03/EoinASP/"
><FONT color=white
>PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
</FONT>
<table BORDER="4" ALIGN="center" CELLPADDING="5"
COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
<colgroup>
<col ALIGN="middle">
<col ALIGN="middle">
<col ALIGN="middle">
</colgroup>
<caption ALIGN="top"><big><u>Employee Database</u></big>
</caption><BR>
<thead>
<TR>
<th>ID Number
<th>Employee Name</th>
<th>Extension No</th>
<th>Mentor ID</th>
<th>Salary Level</th>
<th>Team ID</th></TR>
</thead>
<TBODY>
<tr></tr>
<tbody>
<%
Dim Conn, selectSQL, RecSet
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL
Server};SERVER=apcintern03;DATABASE=ExampleDB;UID=;PWD=;DSN=ExampleDB;"
selectSQL = "SELECT * FROM Employee"
Set RecSet = Conn.Execute (selectSQL)
If NOT RecSet.EOF THEN
DO UNTIL RecSet.EOF
Response.Write "<TR>" & "<TD>" & RecSet("IDNumber") & "</TD>" & "<TD>" &
RecSet("EmpName") & "</TD>" & "<TD>" & RecSet("ExtensionNo") & "</TD>"
& "<TD>" & RecSet("MentorID") & "</TD>" & "<TD>" & RecSet("SalaryLevel")
& "</TD>" & "<TD>" & RecSet("TeamID") & "</TD>" & "</TR>"
RecSet.MoveNext
Loop
End If
RecSet.Close
Set RecSet = Nothing
%>
</tbody>
<br><br>
<b><u>Fill in Form in order to Submit New Employee to Employee
Database</u></b><br>
<form ACTION="http://apcintern03/Eoin/ASPProject/ASPFiles/page1.asp"
METHOD=get id=form1 name=form1>
ID Number <input name="IDNumber" size="4" maxlength="4" >
Name <input name="Name" size="35" maxlength="25" ><br><br>
Extension No <input name="ExtensionNo" size="10" maxlength="10" >
Mentor ID <select name="MentorID" size="1">
<option selected> 1901
<option> 1902
<option> 1903
<option> 1904
<option> 1905
<option> 1906
<option> 1907
<option> 1908</option>
</select>
Salary Level <select name="SalaryLevel" size="1">
<option selected> 1
<option> 2
<option> 3
<option> 4
<option> 5</option>
</select>
TeamID <select name="TeamID" value="" size="1">
<option selected
> JT
<option> JT2
<option> NET
<option> VBT
<option> DBT
<option> ASPT</option>
</select><br><br>
<input value="Submit New Employee" type="submit" id=submit1 name=submit1>
<input value="Reset" type="reset" name="reset">
</form><br>
<%
Dim nIDNumber, strEmpName, strExtensionNo, nMentorID, nSalaryLevel,
strTeamID, strSQL
if Request.QueryString<>"" then
nIDNumber = Request.QueryString("IDNumber")
strEmpName = Request.QueryString("EmpName")
strExtensionNo = Request.QueryString("ExtensionNo")
nMentorID = Request.QueryString("MentorID")
nSalaryLevel = Request.QueryString("SalaryLevel")
strTeamID = Request.QueryString("TeamID")
end if
strSQL = "INSERT INTO Employee VALUES (" & nIDNumber & ",'" &
StrQuoteReplace(strEmpName) & "','" & StrQuoteReplace(strExtensionNo)
& "'," & nMentorID & "," & nSalaryLevel & ",'" & StrQuoteReplace
(strTeamID) & "')"
Conn.Execute(strSQL)
Conn.Close
set Conn = nothing
Function StrQuoteReplace(strValue)
StrQuoteReplace = Replace(strValue, "'", "''")
End Function
%>
</table>
</body>
</html>
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service on behalf of
Kingfield Heath Ltd. For further information visit
http://www.star.net.uk/stats.asp
Message #9 by "Craig Flannigan" <ckf@k...> on Mon, 15 Apr 2002 16:13:51 +0100
|
|
If this is the result, then nothing is getting entered.
Are any of your fields set to "Required" in the table design?
No values from your form are getting to the SQL
-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 16:07
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
I get this INSERT INTO Employee (IDNumber, EmpName, ExtensionNO, MentorID,
SalaryLevel, TeamID) VALUES (,'','',,,'')
-----Original Message-----
From: Craig Flannigan [mailto:ckf@k...]
Sent: Monday, April 15, 2002 11:03 AM
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
You need to run this ASP page again, rather than posting the code listing
again.
Run the page, you'll get the same error again, but it should write the SQL
code with the values filled in onto the screen. It's that part I need to see
where the commas missing.
-----Original Message-----
From: Hayes_Eoin@e... [mailto:Hayes_Eoin@e...]
Sent: 15 April 2002 15:58
To: ASP Databases
Subject: [asp_databases] RE: HELP!!!!! 80040E14 error - Incorrect sy
ntax near ',' - line 137
<%Option Explicit%>
<html>
<head>
META http-equiv=3D"Refresh" content=3D"15";
url=3D"http://apcintern03/Eoinasp/page1.asp"
<title>Eoin's first Page</title></head>
<body bgcolor="#0000a0" text="#ffffff">
<a href="http://apcintern03/EoinASP/"
><FONT color=white
>PREVIOUS</FONT></a><FONT style="BACKGROUND-COLOR: mediumblue">
</FONT>
<table BORDER="4" ALIGN="center" CELLPADDING="5"
COLS="6" RULES="cols" WIDTH="70%" style="WIDTH: 70%">
<colgroup>
<col ALIGN="middle">
<col ALIGN="middle">
<col ALIGN="middle">
</colgroup>
<caption ALIGN="top"><big><u>Employee Database</u></big>
</caption><BR>
<thead>
<TR>
<th>ID Number
<th>Employee Name</th>
<th>Extension | |