jscript and asp for a beginner 
Author Message
 jscript and asp for a beginner

hi everybody
this is my first try with a jscript and asp and i got stocked.
i got the connection to the database but i cant read from the imput
field.
if you put a text direct in the script, it will read and write the
dataset. where is the mistake. who can help me?


<h2>Table auslesen</h2>
<form method="post" action="abfragen1.asp">
<input type="text" name="suchwert" value="<%=Request("suchwert")%>">
<input type="submit" name="Button" value="Abschicken">
</form>
<h2>&nbsp;</h2>
<table border="1" cellpadding="4">
<tr>
<th>tblGlosBegriff</th>
<th>tblGlosErkl?rung</th>
</tr>

<%
var conn=Server.CreateObject("ADODB.Connection");
var rs=Server.CreateObject("ADODB.recordset");
conn.open("WP001A1003","","");
rs=conn.execute("SELECT * FROM db WHERE (tblGlosBegriff LIKE
'suchwert')");
rs=conn.execute("SELECT * FROM tblGlosBegriff WHERE (tblGlosBegriff LIKE
'suchwert')");
while (!rs.EOF)
{
Response.write("<tr>");
Response.write("<td>"+rs("tblGlosBegriff")+"</td>");
Response.write("<td>"+rs("tblGlosErkl?rung")+"</td>");
Response.write("</tr>");
rs.MoveNext();

Quote:
}

rs.close();
conn.close();
%>
</table>


Fri, 25 Jul 2003 18:16:01 GMT  
 jscript and asp for a beginner
hello,

all you need is to change
rs=conn.execute("SELECT * FROM db WHERE (tblGlosBegriff LIKE
'suchwert')");

to
rs=conn.execute("SELECT * FROM db WHERE (tblGlosBegriff LIKE
'"+Request("suchwert"+"')");
(and do the same for the second SELECT)

--
Dmitry Svetlanov
Brainbench MVP for JavaScript
http://www.brainbench.com


Quote:
> hi everybody
> this is my first try with a jscript and asp and i got stocked.
> i got the connection to the database but i cant read from the imput
> field.
> if you put a text direct in the script, it will read and write the
> dataset. where is the mistake. who can help me?


> <h2>Table auslesen</h2>
> <form method="post" action="abfragen1.asp">
> <input type="text" name="suchwert" value="<%=Request("suchwert")%>">
> <input type="submit" name="Button" value="Abschicken">
> </form>
> <h2>&nbsp;</h2>
> <table border="1" cellpadding="4">
> <tr>
> <th>tblGlosBegriff</th>
> <th>tblGlosErkl?rung</th>
> </tr>

> <%
> var conn=Server.CreateObject("ADODB.Connection");
> var rs=Server.CreateObject("ADODB.recordset");
> conn.open("WP001A1003","","");
> rs=conn.execute("SELECT * FROM db WHERE (tblGlosBegriff LIKE
> 'suchwert')");
> rs=conn.execute("SELECT * FROM tblGlosBegriff WHERE (tblGlosBegriff LIKE
> 'suchwert')");
> while (!rs.EOF)
> {
> Response.write("<tr>");
> Response.write("<td>"+rs("tblGlosBegriff")+"</td>");
> Response.write("<td>"+rs("tblGlosErkl?rung")+"</td>");
> Response.write("</tr>");
> rs.MoveNext();
> }
> rs.close();
> conn.close();
> %>
> </table>



Fri, 25 Jul 2003 19:59:57 GMT  
 jscript and asp for a beginner
Hi

rs=conn.Execute("SELECT * FROM tblGlosBegriff WHERE tblGlosBegriff LIKE '" +
Request.Form("suchwert") + "%'");

Or

"SELECT * FROM tblGlosBegriff WHERE tblGlosBegriff LIKE '%" +
Request.Form("suchwert") + "%'"

--
--
Best Regards
  Vidar Petursson
 ==============================
   Microsoft Internet, Client, SDK MVP
 ==============================
 http://www.icysoft.com
 http://www.dna.is



 ==============================
  No matter where you go there you are
 ==============================
--


Quote:
> hi everybody
> this is my first try with a jscript and asp and i got stocked.
> i got the connection to the database but i cant read from the imput
> field.
> if you put a text direct in the script, it will read and write the
> dataset. where is the mistake. who can help me?


> <h2>Table auslesen</h2>
> <form method="post" action="abfragen1.asp">
> <input type="text" name="suchwert" value="<%=Request("suchwert")%>">
> <input type="submit" name="Button" value="Abschicken">
> </form>
> <h2>&nbsp;</h2>
> <table border="1" cellpadding="4">
> <tr>
> <th>tblGlosBegriff</th>
> <th>tblGlosErkl?rung</th>
> </tr>

> <%
> var conn=Server.CreateObject("ADODB.Connection");
> var rs=Server.CreateObject("ADODB.recordset");
> conn.open("WP001A1003","","");
> rs=conn.execute("SELECT * FROM db WHERE (tblGlosBegriff LIKE
> 'suchwert')");
> rs=conn.execute("SELECT * FROM tblGlosBegriff WHERE (tblGlosBegriff LIKE
> 'suchwert')");
> while (!rs.EOF)
> {
> Response.write("<tr>");
> Response.write("<td>"+rs("tblGlosBegriff")+"</td>");
> Response.write("<td>"+rs("tblGlosErkl?rung")+"</td>");
> Response.write("</tr>");
> rs.MoveNext();
> }
> rs.close();
> conn.close();
> %>
> </table>



Fri, 25 Jul 2003 20:33:14 GMT  
 jscript and asp for a beginner
hi
thanks a lot! your tip was the right one. my database is running fine now.
exept one thing. how can i add a error message if no dataset was found in asp?
can you help me once again?
thanks and regards
reto

Vidar Petursson schrieb:

Quote:
> Hi

> rs=conn.Execute("SELECT * FROM tblGlosBegriff WHERE tblGlosBegriff LIKE '" +
> Request.Form("suchwert") + "%'");

> Or

> "SELECT * FROM tblGlosBegriff WHERE tblGlosBegriff LIKE '%" +
> Request.Form("suchwert") + "%'"

> --
> --
> Best Regards
>   Vidar Petursson
>  ==============================
>    Microsoft Internet, Client, SDK MVP
>  ==============================
>  http://www.icysoft.com
>  http://www.dna.is



>  ==============================
>   No matter where you go there you are
>  ==============================
> --



> > hi everybody
> > this is my first try with a jscript and asp and i got stocked.
> > i got the connection to the database but i cant read from the imput
> > field.
> > if you put a text direct in the script, it will read and write the
> > dataset. where is the mistake. who can help me?


> > <h2>Table auslesen</h2>
> > <form method="post" action="abfragen1.asp">
> > <input type="text" name="suchwert" value="<%=Request("suchwert")%>">
> > <input type="submit" name="Button" value="Abschicken">
> > </form>
> > <h2>&nbsp;</h2>
> > <table border="1" cellpadding="4">
> > <tr>
> > <th>tblGlosBegriff</th>
> > <th>tblGlosErkl?rung</th>
> > </tr>

> > <%
> > var conn=Server.CreateObject("ADODB.Connection");
> > var rs=Server.CreateObject("ADODB.recordset");
> > conn.open("WP001A1003","","");
> > rs=conn.execute("SELECT * FROM db WHERE (tblGlosBegriff LIKE
> > 'suchwert')");
> > rs=conn.execute("SELECT * FROM tblGlosBegriff WHERE (tblGlosBegriff LIKE
> > 'suchwert')");
> > while (!rs.EOF)
> > {
> > Response.write("<tr>");
> > Response.write("<td>"+rs("tblGlosBegriff")+"</td>");
> > Response.write("<td>"+rs("tblGlosErkl?rung")+"</td>");
> > Response.write("</tr>");
> > rs.MoveNext();
> > }
> > rs.close();
> > conn.close();
> > %>
> > </table>



Sat, 26 Jul 2003 00:12:54 GMT  
 jscript and asp for a beginner
Hi

No problemo

var  rs=conn.Execute("SELECT * FROM tblGlosBegriff WHERE tblGlosBegriff LIKE
'" + Request.Form("suchwert") + "%'");
if(!rs.EOF)
  {// You have some data

  }

And / Or

while(!rs.EOF)
        {
         Response.Write( rs("theFieldName")  + "<br>" );
         rs.MoveNext();
         }
 rs.Close();

--
--
Best Regards
  Vidar Petursson
 ==============================
   Microsoft Internet, Client, SDK MVP
 ==============================
 http://www.icysoft.com
 http://www.dna.is



 ==============================
  No matter where you go there you are
 ==============================
--


Quote:
> hi
> thanks a lot! your tip was the right one. my database is running fine now.
> exept one thing. how can i add a error message if no dataset was found in
asp?
> can you help me once again?
> thanks and regards
> reto

> Vidar Petursson schrieb:

> > Hi

> > rs=conn.Execute("SELECT * FROM tblGlosBegriff WHERE tblGlosBegriff LIKE
'" +
> > Request.Form("suchwert") + "%'");

> > Or

> > "SELECT * FROM tblGlosBegriff WHERE tblGlosBegriff LIKE '%" +
> > Request.Form("suchwert") + "%'"

> > --
> > --
> > Best Regards
> >   Vidar Petursson
> >  ==============================
> >    Microsoft Internet, Client, SDK MVP
> >  ==============================
> >  http://www.icysoft.com
> >  http://www.dna.is



> >  ==============================
> >   No matter where you go there you are
> >  ==============================
> > --



> > > hi everybody
> > > this is my first try with a jscript and asp and i got stocked.
> > > i got the connection to the database but i cant read from the imput
> > > field.
> > > if you put a text direct in the script, it will read and write the
> > > dataset. where is the mistake. who can help me?


> > > <h2>Table auslesen</h2>
> > > <form method="post" action="abfragen1.asp">
> > > <input type="text" name="suchwert" value="<%=Request("suchwert")%>">
> > > <input type="submit" name="Button" value="Abschicken">
> > > </form>
> > > <h2>&nbsp;</h2>
> > > <table border="1" cellpadding="4">
> > > <tr>
> > > <th>tblGlosBegriff</th>
> > > <th>tblGlosErkl?rung</th>
> > > </tr>

> > > <%
> > > var conn=Server.CreateObject("ADODB.Connection");
> > > var rs=Server.CreateObject("ADODB.recordset");
> > > conn.open("WP001A1003","","");
> > > rs=conn.execute("SELECT * FROM db WHERE (tblGlosBegriff LIKE
> > > 'suchwert')");
> > > rs=conn.execute("SELECT * FROM tblGlosBegriff WHERE (tblGlosBegriff
LIKE
> > > 'suchwert')");
> > > while (!rs.EOF)
> > > {
> > > Response.write("<tr>");
> > > Response.write("<td>"+rs("tblGlosBegriff")+"</td>");
> > > Response.write("<td>"+rs("tblGlosErkl?rung")+"</td>");
> > > Response.write("</tr>");
> > > rs.MoveNext();
> > > }
> > > rs.close();
> > > conn.close();
> > > %>
> > > </table>



Sat, 26 Jul 2003 00:29:04 GMT  
 jscript and asp for a beginner
hi vidar

thanks a lot for your try to help me again. but i guess this was already too
much for my knowlidge. can you please mark my script where i have to put what
and where i can type my error message if nothing could be found? this would be
just great.
this is the actual script wich is working fine.

<%
var conn=Server.CreateObject("ADODB.Connection");
var rs=Server.CreateObject("ADODB.recordset");
conn.open("WP001A1003","","");
rs=conn.execute("SELECT * FROM db WHERE tblGlosBegriff LIKE
'"+Request.Form("suchwert")+"%'");
while (!rs.EOF)
{
Response.write("<tr>");
Response.write("<td>"+rs("tblGlosBegriff")+"</td>");
Response.write("<td>"+rs("tblGlosErkl?rung")+"</td>");
Response.write("</tr>");
rs.MoveNext();

Quote:
}

rs.close();
conn.close();
%>

hope you dont mind and thanks to iceland from switzerland
regards and a nice day
reto

Vidar Petursson schrieb:

Quote:
> Hi

> No problemo

> var  rs=conn.Execute("SELECT * FROM tblGlosBegriff WHERE tblGlosBegriff LIKE
> '" + Request.Form("suchwert") + "%'");
> if(!rs.EOF)
>   {// You have some data

>   }

> And / Or

> while(!rs.EOF)
>         {
>          Response.Write( rs("theFieldName")  + "<br>" );
>          rs.MoveNext();
>          }
>  rs.Close();

> --
> --
> Best Regards
>   Vidar Petursson
>  ==============================
>    Microsoft Internet, Client, SDK MVP
>  ==============================
>  http://www.icysoft.com
>  http://www.dna.is



>  ==============================
>   No matter where you go there you are
>  ==============================
> --



> > hi
> > thanks a lot! your tip was the right one. my database is running fine now.
> > exept one thing. how can i add a error message if no dataset was found in
> asp?
> > can you help me once again?
> > thanks and regards
> > reto

> > Vidar Petursson schrieb:

> > > Hi

> > > rs=conn.Execute("SELECT * FROM tblGlosBegriff WHERE tblGlosBegriff LIKE
> '" +
> > > Request.Form("suchwert") + "%'");

> > > Or

> > > "SELECT * FROM tblGlosBegriff WHERE tblGlosBegriff LIKE '%" +
> > > Request.Form("suchwert") + "%'"

> > > --
> > > --
> > > Best Regards
> > >   Vidar Petursson
> > >  ==============================
> > >    Microsoft Internet, Client, SDK MVP
> > >  ==============================
> > >  http://www.icysoft.com
> > >  http://www.dna.is



> > >  ==============================
> > >   No matter where you go there you are
> > >  ==============================
> > > --



> > > > hi everybody
> > > > this is my first try with a jscript and asp and i got stocked.
> > > > i got the connection to the database but i cant read from the imput
> > > > field.
> > > > if you put a text direct in the script, it will read and write the
> > > > dataset. where is the mistake. who can help me?


> > > > <h2>Table auslesen</h2>
> > > > <form method="post" action="abfragen1.asp">
> > > > <input type="text" name="suchwert" value="<%=Request("suchwert")%>">
> > > > <input type="submit" name="Button" value="Abschicken">
> > > > </form>
> > > > <h2>&nbsp;</h2>
> > > > <table border="1" cellpadding="4">
> > > > <tr>
> > > > <th>tblGlosBegriff</th>
> > > > <th>tblGlosErkl?rung</th>
> > > > </tr>

> > > > <%
> > > > var conn=Server.CreateObject("ADODB.Connection");
> > > > var rs=Server.CreateObject("ADODB.recordset");
> > > > conn.open("WP001A1003","","");
> > > > rs=conn.execute("SELECT * FROM db WHERE (tblGlosBegriff LIKE
> > > > 'suchwert')");
> > > > rs=conn.execute("SELECT * FROM tblGlosBegriff WHERE (tblGlosBegriff
> LIKE
> > > > 'suchwert')");
> > > > while (!rs.EOF)
> > > > {
> > > > Response.write("<tr>");
> > > > Response.write("<td>"+rs("tblGlosBegriff")+"</td>");
> > > > Response.write("<td>"+rs("tblGlosErkl?rung")+"</td>");
> > > > Response.write("</tr>");
> > > > rs.MoveNext();
> > > > }
> > > > rs.close();
> > > > conn.close();
> > > > %>
> > > > </table>



Sat, 26 Jul 2003 16:44:20 GMT  
 jscript and asp for a beginner
Just test the recordset for eof.

Like so..
Assuming you declared rs as the recordset.

 if rs.eof then
   response.redirect "somewhere.asp"
end if


Quote:
> hi
> thanks a lot! your tip was the right one. my database is running fine now.
> exept one thing. how can i add a error message if no dataset was found in
asp?
> can you help me once again?
> thanks and regards
> reto

> Vidar Petursson schrieb:

> > Hi

> > rs=conn.Execute("SELECT * FROM tblGlosBegriff WHERE tblGlosBegriff LIKE
'" +
> > Request.Form("suchwert") + "%'");

> > Or

> > "SELECT * FROM tblGlosBegriff WHERE tblGlosBegriff LIKE '%" +
> > Request.Form("suchwert") + "%'"

> > --
> > --
> > Best Regards
> >   Vidar Petursson
> >  ==============================
> >    Microsoft Internet, Client, SDK MVP
> >  ==============================
> >  http://www.icysoft.com
> >  http://www.dna.is



> >  ==============================
> >   No matter where you go there you are
> >  ==============================
> > --



> > > hi everybody
> > > this is my first try with a jscript and asp and i got stocked.
> > > i got the connection to the database but i cant read from the imput
> > > field.
> > > if you put a text direct in the script, it will read and write the
> > > dataset. where is the mistake. who can help me?


> > > <h2>Table auslesen</h2>
> > > <form method="post" action="abfragen1.asp">
> > > <input type="text" name="suchwert" value="<%=Request("suchwert")%>">
> > > <input type="submit" name="Button" value="Abschicken">
> > > </form>
> > > <h2>&nbsp;</h2>
> > > <table border="1" cellpadding="4">
> > > <tr>
> > > <th>tblGlosBegriff</th>
> > > <th>tblGlosErkl?rung</th>
> > > </tr>

> > > <%
> > > var conn=Server.CreateObject("ADODB.Connection");
> > > var rs=Server.CreateObject("ADODB.recordset");
> > > conn.open("WP001A1003","","");
> > > rs=conn.execute("SELECT * FROM db WHERE (tblGlosBegriff LIKE
> > > 'suchwert')");
> > > rs=conn.execute("SELECT * FROM tblGlosBegriff WHERE (tblGlosBegriff
LIKE
> > > 'suchwert')");
> > > while (!rs.EOF)
> > > {
> > > Response.write("<tr>");
> > > Response.write("<td>"+rs("tblGlosBegriff")+"</td>");
> > > Response.write("<td>"+rs("tblGlosErkl?rung")+"</td>");
> > > Response.write("</tr>");
> > > rs.MoveNext();
> > > }
> > > rs.close();
> > > conn.close();
> > > %>
> > > </table>



Sat, 02 Aug 2003 00:31:25 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Beginner: Jscript / Vbscript

2. ASP beginners guide available

3. select values--posting to mdb (beginner, asp)

4. How do I call JScript functions from within ASP written in JScript

5. Common Bridge Between JScript, ASP and ASP.NET

6. Anyone porting JScript ASP pages to JScript .NET and ASP .NET?

7. Vbscript class in jscript page (ASP)

8. calling ASP from within VBScript/JScript ???????

9. NEWBIE: jscript, asp, cache ?

10. JScript - Iterating Through Form (Collection) on serverside ASP

11. How to use a variable from a JScript in a VBScript in the same asp file

12. Jscript and ASP

 

 
Powered by phpBB® Forum Software