Click to See Complete Forum and Search --> : Request.QueryString("name")
hi,
i have a problem of Request.QueryString("name")
i send the name to current page with QueryString i mean
?name=somthing
but i can make request the name and insert it to table i dont
know why if you have any help write it bye
roby
punkpie_uk
12-23-2002, 06:55 AM
I'm not sure what it is you want to do. Do you want to use Request.QueryString("name") and enter the value in a table cell?
<table>
<tr>
<td><%=Request.QueryString("name")%></td>
</tr>
</table>
hi,
no i don't want this but i want to insert in a table in a
data base in microsoft access and can i take the value from any page and insert it to that table that is the Q?
roby
hi, dave
it is does't work i dont know why...
then i make test to the take the value and it is work like
i make request.queryString("") and save it in a variable name
then i print it and it is written but i can't insert it to a table in a database tell me why
roby
hi,
yes i know i make it last time but it does'n work
roby
vishu_gupt
12-26-2002, 08:01 AM
HI,
May this line of code will help you though Dave has written the same thing in a different way.
=====================
strSQL="Update <table_name> set <field_name>='" &
replace(trim(request.queryString("name")),"'","''") & "' where <where_condition>"
'' now execute the query with connection obj. I assume CONN is your active connection object
CONN.execute (strSQL)
======================
Hope it will work.
Vishal Gupta
hi,
that is the code (the cname and tname are received from other page like this
(addcar.asp ?cname=cname&tname=tname))
the code
<%@language=VBScript CodePage="1256"%>
<!-- #include file="adovbs.inc" -->
<%
dim db
Dim DB_CONNECTION
DB_CONNECTION = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("./db") & ";"
%>
<%
dim uname
company= Request.QueryString("cname")
type= Request.QueryString("tname")
xtype = request.form("xtype")
model= request.form("model")
gare= request.form("gare")
icolor= request.form("icolor")
ocolor= request.form("ocolor")
grade= request.form("grade")
destance= request.form("destance")
price= request.form("price")
xprice= request.form("xprice")
image= request.form("image")
uname=session("uname")
%>
<%
Function AddF()
dim addsql
Set db = Server.CreateObject("ADODB.Connection")
db.open DB_CONNECTION
addSQL= " insert into usercar (cname,tname,xtype,model,gare,icolor,ocolor,grade,destance,price,xprice,image,uname) values ('"&cname&"','"&tname&"','"&xtype&"','"&model&"','"&gare&"','"&icolor&"','"&ocolor&"','"&grade&"','"&destance&"','"&price&"','"&xprice&"','"&image&"','"&uname&"')"
db.execute(addSQL)
db.close
set db=nothing
End Function
%>
<%
Dim objRecordset
dim sqls
%>
<%
If xtype="" and destance="" and price="" then
response.write ""
else
AddF()
response.redirect "result.asp"
End If
%>
<%
%>
<html dir="rtl">
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<title>New Page 1</title>
</head>
<body>
<form method="POST" action="addcar.asp" onSubmit="">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="25%" align="left">
<p> </td>
<td width="25%" align="left"><font color="#FF0000">*</font>xtype</td>
<td width="25%">
<input name="xtype"
size="20" style="float: left"></td>
</tr>
<tr>
<td width="25%"> </td>
<td width="25%" align="left"><font color="#FF0000">*</font>model</td>
<td width="25%" align="left"> <select size="1" name="model">
<option selected>2000</option>
<option>2001</option>
<option>2002</option>
<option>2003</option>
</select></td>
<td width="25%"> </td>
</tr>
<tr>
<td width="25%"> </td>
<td width="25%" align="left"><font color="#FF0000">*</font> gare</td>
<td width="25%" align="left"> <select size="1" name="gare">
<option selected>auto</option>
<option>manual</option>
<option>both</option>
</select></td>
<td width="25%"> </td>
</tr>
<tr>
<td width="25%"> </td>
<td width="25%" align="left"><font color="#FF0000">*</font>inside color</td>
<td width="25%" align="left"> <select size="1" name="icolor">
<option selected>red</option>
<option>black</option>
<option>blue</option>
</select></td>
<td width="25%"> </td>
</tr>
<tr>
<td width="25%"> </td>
<td width="25%" align="left"><font color="#FF0000">*</font>outside color</td>
<td width="25%" align="left"> <select size="1" name="ocolor">
<option>red</option>
<option>black</option>
<option>blue</option>
<option>green</option>
<option selected>white</option>
</select></td>
<td width="25%"> </td>
</tr>
<tr>
<td width="25%"> </td>
<td width="25%" align="left"><font color="#FF0000">*</font>grade</td>
<td width="25%" align="left"> <select size="1" name="grade">
<option selected>good</option>
<option>bad</option>
<option>excelent</option>
<option>normal</option>
</select></td>
<td width="25%"> </td>
</tr>
<tr>
<td width="25%"> </td>
<td width="25%" align="left"><font color="#FF0000">*</font>distance</td>
<td width="25%" align="left"><input type="text" name="destance"
size="20"></td>
<td width="25%"> </td>
</tr>
<tr>
<td width="25%"> </td>
<td width="25%" align="left"><font color="#FF0000">*</font> price</td>
<td width="25%" align="left">
<input type="text" name="price"
size="20"></td>
<td width="25%"> </td>
</tr>
<tr>
<td width="25%"> </td>
<td width="25%" align="left"><font color="#FF0000">*</font> condition price</td>
<td width="25%" align="left"><select size="1" name="xprice">
<option selected>yes</option>
<option>no</option>
</select></td>
<td width="25%"> </td>
</tr>
</table>
<%
%>
<p align="center"><input type="submit" value="add" name="B1"></p>
</form>
</body>
</html>
hi,
i change the mistake but it does't work, can you find other mistake.
the code
company= Request.QueryString("cname")
type= Request.QueryString("tname")
addSQL= " insert into usercar (company,type,xtype,model,gare,icolor,ocolor,grade,destance,price,xprice,image,uname) values ('"&company&"','"&type&"','"&xtype&"','"&model&"','"&gare&"','"&icolor&"','"&ocolor&"','"&grade&"','"&destance&"','"&price&"','"&xprice&"','"&image&"','"&uname&"')"
roby
hi dave,
no error message but if i see the table on my DB i see all the field is correct exept (copany and type is empty).
roby
hi dave,
i make response.write to the company and type and it is written that mean the receiving i good and if i make the company take any name const it will written in the DB but if i make the company is not const it will write nothing :confused:
i don't know what happen
roby
company = "test_company"
type = "test_type"
addSQL= " insert into usercar (company,type,xtype,model,gare,icolor,ocolor,grade,destance,price,xprice,image,uname) values ('"&company&"','"&type&"','"&xtype&"','"&model&"','"&gare&"','"&icolor&"','"&ocolor&"','"&grade&"','"&destance&"','"&price&"','"&xprice&"','"&image&"','"&uname&"')"
hi dave,
it will write in the DB test_compny in company field and test_type in type field and i don't want this
roby
hi dave,
and if i write this
<%
company= Request.QueryString("cname")
type= Request.QueryString("tname")
response.write company
response.write type
%>
it will write the correct value that i want it but i can't write the value in the DB:confused:
roby
Originally posted by Dave Clark
Then the problem has got to be in your SQL statement.
Dave
hi dave,
i don't think so because the SQL statmant is work for any value but i think i have a very small proplem in current palce
i don't know where .
roby
hi dave,
my problem is very small and it does't take the value of money if you give me the answer free i will thank you and if you don't i will thank you :D goodbye
roby
vishu_gupt
01-07-2003, 12:24 AM
HI Roby,
I read all the comments and posts on this issue. I would like to state few points here. Try them.
1. Write the field names in sql query as ([company],[type]....
2. Check the field lengths in your database. May be they are not enough to take the full value.
3. Write the SQL query on screen using Response.write and then copy and run the same on MSAccess directly. See if it returns any message or error.
If every thing is file then send me the smaple ASP code and database. I will look into it.
--
Vishal
Originally posted by vishu_gupt
HI Roby,
I read all the comments and posts on this issue. I would like to state few points here. Try them.
1. Write the field names in sql query as ([company],[type]....
2. Check the field lengths in your database. May be they are not enough to take the full value.
3. Write the SQL query on screen using Response.write and then copy and run the same on MSAccess directly. See if it returns any message or error.
If every thing is file then send me the smaple ASP code and database. I will look into it.
--
Vishal
hi Vishal,
it is does't work then how can i send the codes and DB for you
by e-mail or what tell me
roby
vishu_gupt
01-07-2003, 03:51 AM
HI,
Send me an email on vishu_gupt@usa.net.