|
| Help with ASP code please Fra : ___Zoom |
Dato : 01-05-02 05:45 |
|
Hi,
I had an example asp code which makes use of an *.mdb file (with only two
fields) by searching one field and listing the other if found (actually it
is a simple dictionary example). But I couldn't adopt it to a new situation.
Say I have an ms access file called "archieve.mdb" which has a Sheet1 form
including eleven fields starting from Field1, Feield2,...,Field11. By using
an asp code, I want to be able to make searches on 4 of the fields (i.e.
Feild3, Feild5, Feild8 and Feild11) and if inputs match for ALL of these 4
feilds I want these records (with all 11 fields) to be listed on a new
window...
Could anyone help providing me the code?. Thanks in advance.
M. Wilson
| |
Tony Lorentzen (01-05-2002)
| Kommentar Fra : Tony Lorentzen |
Dato : 01-05-02 14:20 |
|
"___Zoom" <2l8t0efje3pb94001@sneakemail.com> wrote in message
news:aans3j$c07re$1@ID-67854.news.dfncis.de...
> Hi,
>
> Could anyone help providing me the code?. Thanks in advance.
Dear M. Wilson,
This newsgroup doesn't provide people with complete code examples, but
encourage people to try finding the solutions themselves with a bit of help
.... If you're stuck with a problem in your existing code we'd be glad to
help with corrections or hints. This way you will learn more about how ASP
works and how the problems are solved. If you have some code then please
submit it with a complete error-description or a link to the actual script.
In your given example I'd encourage you to check out some simple examples on
how to access data with ADO. Try searching google.com - I'm sure you'll find
some helpful tutorials.
Regards,
Tony Lorentzen
| |
___Zoom (01-05-2002)
| Kommentar Fra : ___Zoom |
Dato : 01-05-02 17:50 |
|
Dear Tony Lorentzen,
Here are my asp codes that works with no problem:
----------------------------------------------------------------
For searching I use this code below residing at the server as "arama.asp"
________________________________
<html>
<head>
<title>ARAMA SAYFASI</title>
<meta http-equiv="Content-Type" content="text/html; charset=1254">
</head>
<body bgcolor="#FFFFFF">
<%
set conn=server.createobject("adodb.connection")
dsnpath="DRIVER={MICROSOFT ACCESS DRIVER (*.mdb)};"
dsnpath=dsnpath & "DBQ=" & Server.mappath("dbbilgi.mdb")
conn.open dsnpath
sql="SELECT * FROM Sheet1;"
Set rs=conn.execute(sql)
tpl=0
say=1
%>
<table width="215" border="0" cellspacing="2" cellpadding="0" height="79">
<tr>
<td width="496" bgcolor="#6060FF" height="21">
<div align="center"></div>
</td>
</tr>
<tr>
<td width="496" align="left" valign="top" height="111">
<table width="222" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#FFFFCC">
<td width="220">
<form method="post" action="arama_sonuclari.asp" name="fname">
<p> </p>
<div align="center">
<p>
<input type="text" name="arama" size="15" maxlength="100">
</p>
<p>
<input type="submit" name="ara" value=" Ara ">
</p>
</div>
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="496" align="left" valign="top" height="1">
<div align="center"><b><font color="#FF0000" face="Tahoma"
size="2">Lütfen
aradýðýnýz
teknik-terimin tümünü büyük harf olarak giriniz.</font></b></div>
<div align="center" style="width: 220; height: 41">
<p><font size="2" face="Tahoma">Ana sayfaya dönmek için <a
href="indextr.html">Týklayýnýz.</a></font></p>
<p> </div>
</td>
</tr>
</table>
</body>
</html>
_____________________________________________________
For displaying the saerch results I use this ASP code below residing at the
server as "arama_sonuclari.asp"
---------------------------------------
<html>
<head>
<title>ARAMA SONUÇLARI</title>
<meta http-equiv="Content-Type" content="text/html; charset=1254">
</head>
<body bgcolor="#FFFFFF">
<%
set conn=server.createobject("adodb.connection")
dsnpath="DRIVER={MICROSOFT ACCESS DRIVER (*.mdb)};"
dsnpath=dsnpath & "DBQ=" & Server.mappath("dbbilgi.mdb")
conn.open dsnpath
sql="SELECT * FROM Sheet1;"
Set rs=conn.execute(sql)
tpl=0
say=1
%>
<table width="81%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="4" bgcolor="#6666FF">
<div align="center"><font face="Tahoma" color="#FFFFFF"
size="2"><b>TEKNÝK
TERÝM KARÞILIKLARI</b></font></div>
</td>
</tr>
<tr>
<td width="85%" colspan="4" rowspan="2" align="left" valign="top">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="14%"><font color="#0000FF"><b><font size="2"
face="Tahoma">Kayýt
No</font></b></font></td>
<td width="22%"><font color="#0000FF"><b><font size="2"
face="Tahoma">Ýngilizce</font></b></font></td>
<td width="25%"><font color="#0000FF"><b><font size="2"
face="Tahoma">Türkçe</font></b></font></td>
</tr>
<%Do while not rs.eof%>
<%if rs("eng")=Ucase(request("arama")) then%>
<tr>
<td width="14%"><%=say%></td>
<td width="22%"><%=rs("eng")%></td>
<td width="25%"><%=rs("tr")%></td>
</tr>
<%
tpl=tpl+1
say=say+1
end if
%> <%
rs.movenext
loop
%>
</table>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<p><font size="2" face="Tahoma">Arama sayfasýna dönmek için <a
href="arama.asp">Týklayýnýz.</a></font></p>
</td>
</tr>
</table>
</body>
</html>
__________________________________________________
Now I am not able to adopt this code so that I can use a different file
(named "archieve.mdb") with ID+eleven fields (ID, Field1,
Field2,...,Field11), and use "Sheet1" form to establish search on 4 of these
Fields (Field3, Field5, Field8 and Field11). The asp code should be able to
list ALL criteria matching records displaying not only these 4 Fields but
the complete record.
Thanks
M.Wilson
"Tony Lorentzen" <tonySPAMMERGOAWAY@lorentzen.com> wrote in message
news:aaoq5a$316t$1@news.cybercity.dk...
| "___Zoom" <2l8t0efje3pb94001@sneakemail.com> wrote in message
| news:aans3j$c07re$1@ID-67854.news.dfncis.de...
| > Hi,
| >
| > Could anyone help providing me the code?. Thanks in advance.
|
| Dear M. Wilson,
|
| This newsgroup doesn't provide people with complete code examples, but
| encourage people to try finding the solutions themselves with a bit of
help
| ... If you're stuck with a problem in your existing code we'd be glad to
| help with corrections or hints. This way you will learn more about how ASP
| works and how the problems are solved. If you have some code then please
| submit it with a complete error-description or a link to the actual
script.
|
| In your given example I'd encourage you to check out some simple examples
on
| how to access data with ADO. Try searching google.com - I'm sure you'll
find
| some helpful tutorials.
|
| Regards,
|
| Tony Lorentzen
|
|
| |
___Zoom (01-05-2002)
| Kommentar Fra : ___Zoom |
Dato : 01-05-02 17:51 |
|
Dear Tony Lorentzen,
Here are my asp codes that works with no problem:
----------------------------------------------------------------
For searching I use this code below residing at the server as "arama.asp"
________________________________
<html>
<head>
<title>ARAMA SAYFASI</title>
<meta http-equiv="Content-Type" content="text/html; charset=1254">
</head>
<body bgcolor="#FFFFFF">
<%
set conn=server.createobject("adodb.connection")
dsnpath="DRIVER={MICROSOFT ACCESS DRIVER (*.mdb)};"
dsnpath=dsnpath & "DBQ=" & Server.mappath("dbbilgi.mdb")
conn.open dsnpath
sql="SELECT * FROM Sheet1;"
Set rs=conn.execute(sql)
tpl=0
say=1
%>
<table width="215" border="0" cellspacing="2" cellpadding="0" height="79">
<tr>
<td width="496" bgcolor="#6060FF" height="21">
<div align="center"></div>
</td>
</tr>
<tr>
<td width="496" align="left" valign="top" height="111">
<table width="222" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#FFFFCC">
<td width="220">
<form method="post" action="arama_sonuclari.asp" name="fname">
<p> </p>
<div align="center">
<p>
<input type="text" name="arama" size="15" maxlength="100">
</p>
<p>
<input type="submit" name="ara" value=" Ara ">
</p>
</div>
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="496" align="left" valign="top" height="1">
<div align="center"><b><font color="#FF0000" face="Tahoma"
size="2">Lütfen
aradýðýnýz
teknik-terimin tümünü büyük harf olarak giriniz.</font></b></div>
<div align="center" style="width: 220; height: 41">
<p><font size="2" face="Tahoma">Ana sayfaya dönmek için <a
href="indextr.html">Týklayýnýz.</a></font></p>
<p> </div>
</td>
</tr>
</table>
</body>
</html>
_____________________________________________________
For displaying the saerch results I use this ASP code below residing at the
server as "arama_sonuclari.asp"
---------------------------------------
<html>
<head>
<title>ARAMA SONUÇLARI</title>
<meta http-equiv="Content-Type" content="text/html; charset=1254">
</head>
<body bgcolor="#FFFFFF">
<%
set conn=server.createobject("adodb.connection")
dsnpath="DRIVER={MICROSOFT ACCESS DRIVER (*.mdb)};"
dsnpath=dsnpath & "DBQ=" & Server.mappath("dbbilgi.mdb")
conn.open dsnpath
sql="SELECT * FROM Sheet1;"
Set rs=conn.execute(sql)
tpl=0
say=1
%>
<table width="81%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="4" bgcolor="#6666FF">
<div align="center"><font face="Tahoma" color="#FFFFFF"
size="2"><b>TEKNÝK
TERÝM KARÞILIKLARI</b></font></div>
</td>
</tr>
<tr>
<td width="85%" colspan="4" rowspan="2" align="left" valign="top">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="14%"><font color="#0000FF"><b><font size="2"
face="Tahoma">Kayýt
No</font></b></font></td>
<td width="22%"><font color="#0000FF"><b><font size="2"
face="Tahoma">Ýngilizce</font></b></font></td>
<td width="25%"><font color="#0000FF"><b><font size="2"
face="Tahoma">Türkçe</font></b></font></td>
</tr>
<%Do while not rs.eof%>
<%if rs("eng")=Ucase(request("arama")) then%>
<tr>
<td width="14%"><%=say%></td>
<td width="22%"><%=rs("eng")%></td>
<td width="25%"><%=rs("tr")%></td>
</tr>
<%
tpl=tpl+1
say=say+1
end if
%> <%
rs.movenext
loop
%>
</table>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<p><font size="2" face="Tahoma">Arama sayfasýna dönmek için <a
href="arama.asp">Týklayýnýz.</a></font></p>
</td>
</tr>
</table>
</body>
</html>
__________________________________________________
Now I am not able to adopt this code so that I can use a different file
(named "archieve.mdb") with ID+eleven fields (ID, Field1,
Field2,...,Field11), and use "Sheet1" form to establish search on 4 of these
Fields (Field3, Field5, Field8 and Field11). The asp code should be able to
list ALL criteria matching records displaying not only these 4 Fields but
the complete record.
Thanks
M.Wilson
"Tony Lorentzen" <tonySPAMMERGOAWAY@lorentzen.com> wrote in message
news:aaoq5a$316t$1@news.cybercity.dk...
| "___Zoom" <2l8t0efje3pb94001@sneakemail.com> wrote in message
| news:aans3j$c07re$1@ID-67854.news.dfncis.de...
| > Hi,
| >
| > Could anyone help providing me the code?. Thanks in advance.
|
| Dear M. Wilson,
|
| This newsgroup doesn't provide people with complete code examples, but
| encourage people to try finding the solutions themselves with a bit of
help
| ... If you're stuck with a problem in your existing code we'd be glad to
| help with corrections or hints. This way you will learn more about how ASP
| works and how the problems are solved. If you have some code then please
| submit it with a complete error-description or a link to the actual
script.
|
| In your given example I'd encourage you to check out some simple examples
on
| how to access data with ADO. Try searching google.com - I'm sure you'll
find
| some helpful tutorials.
|
| Regards,
|
| Tony Lorentzen
|
|
| |
Crea-Ue. Kirdar (07-05-2002)
| Kommentar Fra : Crea-Ue. Kirdar |
Dato : 07-05-02 07:45 |
|
Hi Zoom,
you may have a look at http://www.asp101.com/samples/database.asp.
This could give you an idea, of whats happening on that script. You
may also, as Mr. Lorentzen already said have a look at ASP and/or
SQL-Documentations.
For now:
db.Execute "SELECT * FROM <table> WHERE field1='"+<value>+"' AND
field2='"+<value>+"' AND field3='"+<value>+"'"
Should give you a little help.
Good luck.
Crea
P.S. NG'lere mail yazarken, scriptlerini ingilisceye tercüme etmeni terci
ederim.
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the universe trying to build
bigger and better idiots. So far, the universe is winning.
| |
___Zoom (07-05-2002)
| Kommentar Fra : ___Zoom |
Dato : 07-05-02 15:14 |
|
Thank you very much.
"Crea-Ue. Kirdar" <news@creatorium.de> wrote in message
news:ab838j$fu7os$1@ID-57402.news.dfncis.de...
| Hi Zoom,
|
| you may have a look at http://www.asp101.com/samples/database.asp.
| This could give you an idea, of whats happening on that script. You
| may also, as Mr. Lorentzen already said have a look at ASP and/or
| SQL-Documentations.
|
| For now:
|
| db.Execute "SELECT * FROM <table> WHERE field1='"+<value>+"' AND
| field2='"+<value>+"' AND field3='"+<value>+"'"
|
| Should give you a little help.
|
| Good luck.
|
| Crea
|
| P.S. NG'lere mail yazarken, scriptlerini ingilisceye tercüme etmeni terci
| ederim.
| --
| Programming today is a race between software engineers striving to build
| bigger and better idiot-proof programs, and the universe trying to build
| bigger and better idiots. So far, the universe is winning.
|
|
| |
|
|