Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - insert SQL
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

insert SQL

 Post Reply Post Reply
Author
tomasz View Drop Down
Newbie
Newbie
Avatar

Joined: 04 March 2003
Location: Belgium
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomasz Quote  Post ReplyReply Direct Link To This Post Topic: insert SQL
    Posted: 07 March 2003 at 7:18am

When I insert this in a ASP page...

<%SQL = "SELECT Column1" _ & " FROM Table1 WHERE ID=6" >

... it works but when I want to insert other data from thesame SQL Database but from another table,......

<%SQL = "SELECT Column2" _ & " FROM Table2 WHERE ID=6" >

... it doesn't work anymore.

Can you only use one or is there a solution??

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 07 March 2003 at 9:40am
Both SQL queries are OK, you said you are inserting, where? What is the error. It doesen't work is not an error message I know. Try to be a little more specific what you are doing.
Back to Top
tomasz View Drop Down
Newbie
Newbie
Avatar

Joined: 04 March 2003
Location: Belgium
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomasz Quote  Post ReplyReply Direct Link To This Post Posted: 07 March 2003 at 11:14am

This is my code:

<html>
<head>
<title>Spelers</title>
<%
dbq = Server.MapPath("/dbase/stats.mdb")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);" _
            & "DBQ=" & dbq
%>
</head>
<body>
<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
  <tr>
    <td width="100%">
      <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
                <td width="100%"><b>Doelpunten:&nbsp;</b><%
SQL = "SELECT Doelpunten, ID" _
      & " FROM Topscorer WHERE ID=6"
' and we get our recordset!
Set RS = Conn.Execute( SQL )
If RS.EOF Then
    Response.Write "0"
    Response.End
End If

%>
<%
    Response.Write _
    "" & RS("Doelpunten") & "" & _
%>
</td>
</tr>
<tr>
<td width="100%"><b>Kaarten:</b>
</td>
</tr>
<tr>
<td width="100%"><%
SQL = "SELECT Naam, Kaart, Wedstrijd, Datum" _
      & " FROM Kaartenlast WHERE ID=6"
' and we get our recordset!
Set RS = Conn.Execute( SQL )
If RS.EOF Then
    Response.Write "geen kaarten gekregen"
    Response.End
End If

%>
<TABLE Width='100%' Border=0 bordercolor=#FFFF99 CellPadding=0 CellSpacing=0 bgColor=#FFFFCC>
<%
Do Until RS.EOF
    Response.Write _
   "<TR>" & _
    "    <TD align=""center""><img src=""" & RS("Kaart") & """></TD>" & _
    "    <TD align=""center"">" & RS("Wedstrijd") & "</TD>" & _
    "    <TD align=""center"">" & FormatDateTime( RS("Datum"), vbShortDate ) & "</TD>" & _
    "</TR>" & vbNewLine 
    RS.MoveNext
Loop
%>
<%
conn.close
set conn = Nothing
%>
</TABLE></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
</body>
</html>

This is my code when I choose 'view source' in my browser:

<html>
<head>
<title>Spelers</title>
</head>

<body>
<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#FFFFCC">
  <tr>
    <td width="100%">
      <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
                <td width="100%"><b>Doelpunten:&nbsp;</b>0

It just stops here. Like you see, I'm not getting an error but the second part of my page doesn't appear.

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 07 March 2003 at 12:02pm
Well if this is all you see it means that RS.EOF is TRUE so you need to check you sql script with the db, something seems wrong there.
Back to Top
tomasz View Drop Down
Newbie
Newbie
Avatar

Joined: 04 March 2003
Location: Belgium
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomasz Quote  Post ReplyReply Direct Link To This Post Posted: 07 March 2003 at 2:49pm

I 've found the problem : when the page doesn't find information (in my page where the column 'ID' doesn't have a '6') it stops working. So the problem is in :
If RS.EOF Then
    Response.Write "geen kaarten gekregen"
    Response.End
End If

Is there another way to to display something on the page when the page doesn't find the information??

Back to Top
tomasz View Drop Down
Newbie
Newbie
Avatar

Joined: 04 March 2003
Location: Belgium
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomasz Quote  Post ReplyReply Direct Link To This Post Posted: 07 March 2003 at 3:03pm
YES!! I've found it. I had to remove 'Response.End'. THNX michael for your responses.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.