|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
thanks o lot guys but my code is still not working here is the code can somebody look into it
<i><b>Originally posted by : venkatesh krishnamurthy (venky33@hotmail.com)</b></i><br />here is the html file<br /><html><br /><br /><head><br /><meta http-equiv="Content-Language" content="en-us"><br /><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><br /><meta name="GENERATOR" content="Microsoft FrontPage 4.0"><br /><meta name="ProgId" content="FrontPage.Editor.Document"><br /><title>CATEGORY</title><br /></head><br /><br /><body bgcolor="#FFDCE0"><br /><br /><form name="newcategory" action="insertnewebc1.asp" method="POST"><br /> <table border="0" width="61%" cellspacing="0" cellpadding="0"><br /> <tr><br /> <td width="23%"><b><font color="#000080">CATEGORY</font></b></td><br /> <td width="2%" align="center"><b><font color="#000080">:</font></b></td><br /> <td width="75%"><input type="text" name="category" size="20"></td><br /> </tr><br /> <tr><br /> <td width="23%"><b><font color="#000080">SUBCATEGORY</font></b></td><br /> <td width="2%" align="center"><b><font color="#000080">:</font></b></td><br /> <td width="75%"><input type="text" name="subcategory" size="20"></td><br /> </tr><br /> <tr><br /> <td width="100%" colspan="3"><br /> <p align="center"><input type="submit" value="Insert" name="B1"><input type="reset" value="Clear" name="B2"></td><br /> </tr><br /> </table><br /></form><br /><br /><p align="left"><a href="menu1.htm">BACK</a></p><br /><br /></body><br /><br /></html><br />here is the asp code<br /><html><br /><!--#include file="db.inc"--><br /><head> <br /><base target="main"><br /><title>educationalbookcentre</title><br /></head><br /><body bgcolor=#FFDCE0><br /><%<br />Dim var1<br />Dim var2<br />Dim var3<br />var1 = UCase(Request.form("category"))<br />var2 = UCase(Request.form("subcategory"))<br />var3 = ""'"&Subcategories&"'""<br />Conn.Execute "insert into test1(CATEGORY,SUBCATEGORY) values('"&var1&"','"&var3&"')"<br />Conn.Execute "insert into test1(CATEGORY,SUBCATEGORY) values('"&var1&"','"&var2&"')"<br />Response.Write("One Record Inserted")%><br><br /><A href="newcategory.htm">BACK</A><br><br /><A href="main.htm">BACK To Main Page</A><br /><%Conn.close<br />set Conn=nothing %></body></html><br />and db.inc file<br /><%<br />db=server.mappath("ebc.mdb")<br /><br />connStr = "DBQ=" & db & ";Driver={Microsoft"<br />connStr = connStr & " Access Driver (*.mdb)}"<br />set Conn = server.createobject("adodb.connection")<br />Conn.open connStr<br />%><br />actually i want to insert an single quote and there is a problem with concatination in the asp file can somebody help<br />bye<br /><br />
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : antony (antovelan@usa.net)</b></i><br />thats very simple, before inserting into sQL statement replace u'r single quote by double quote by using following function<br /><br />function doublequote(sqlp)<br />doublequote=replace(sqlp,"'","''")<br />end function<br /><br />now change u'r program sligtly<br /><br />-------------------------<br />changed program by antony<br />-------------------------<br />change var1,var2,var3 into<br /><br /><br />var1=doublequote(request.....)<br />var2=doublequote(request.....)<br />like etc...<br /><br /><html><br /><br /><head><br /><meta http-equiv="Content-Language" content="en-us"><br /><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><br /><meta name="GENERATOR" content="Microsoft FrontPage 4.0"><br /><meta name="ProgId" content="FrontPage.Editor.Document"><br /><title>CATEGORY</title><br /></head><br /><br /><body bgcolor="#FFDCE0"><br /><br /><form name="newcategory" action="insertnewebc1.asp" method="POST"><br /> <table border="0" width="61%" cellspacing="0" cellpadding="0"><br /> <tr><br /> <td width="23%"><b><font color="#000080">CATEGORY</font></b></td><br /> <td width="2%" align="center"><b><font color="#000080">:</font></b></td><br /> <td width="75%"><input type="text" name="category" size="20"></td><br /> </tr><br /> <tr><br /> <td width="23%"><b><font color="#000080">SUBCATEGORY</font></b></td><br /> <td width="2%" align="center"><b><font color="#000080">:</font></b></td><br /> <td width="75%"><input type="text" name="subcategory" size="20"></td><br /> </tr><br /> <tr><br /> <td width="100%" colspan="3"><br /> <p align="center"><input type="submit" value="Insert" name="B1"><input type="reset" value="Clear" name="B2"></td><br /> </tr><br /> </table><br /></form><br /><br /><p align="left"><a href="menu1.htm">BACK</a></p><br /><br /></body><br /><br /></html><br />here is the asp code<br /><html><br /><!--#include file="db.inc"--><br /><head> <br /><base target="main"><br /><title>educationalbookcentre</title><br /></head><br /><body bgcolor=#FFDCE0><br /><%<br />Dim var1<br />Dim var2<br />Dim var3<br />var1 = doblequote(UCase(Request.form("category")))<br />var2 = doblequote(UCase(Request.form("subcategory")))<br />var3 = doublequote(""'"&Subcategories&"'"")<br />Conn.Execute "insert into test1(CATEGORY,SUBCATEGORY) values('"&var1&"','"&var3&"')"<br />Conn.Execute "insert into test1(CATEGORY,SUBCATEGORY) values('"&var1&"','"&var2&"')"<br />Response.Write("One Record Inserted")%><br><br /><A href="newcategory.htm">BACK</A><br><br /><A href="main.htm">BACK To Main Page</A><br /><%Conn.close<br />set Conn=nothing %></body></html><br />and db.inc file<br /><%<br />db=server.mappath("ebc.mdb")<br /><br />connStr = "DBQ=" & db & ";Driver={Microsoft"<br />connStr = connStr & " Access Driver (*.mdb)}"<br />set Conn = server.createobject("adodb.connection")<br />Conn.open connStr<br />%><br />actually i want to insert an single quote and there is a problem with concatination in the asp file can somebody help<br />bye<br /><br />
|
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > thanks o lot guys but my code is still not working here is the code can somebody look into it |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|