Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Database query using Inner join , please help


Message #1 by "baba" <abdelramli@y...> on Wed, 15 Nov 2000 15:51:47 -0000
if anyone could help me in making the following basic codes work

 it is the line under barcket that is causing troubles (according to the

error message displayed on the browser.

I'm simply trying to use Inner join

Your help would be, as always, extremely appreciated.



<%

  Dim strDirector, strCountry, strCriteria

  strDirector = Request.Form("director")

  strcountry = Request.Form("Country")



  Dim objRS

  Set objRS = Server.CreateObject("ADODB.Recordset")



'select order.orderid, order.productid from ORDERS INNERJOIN PRODUCTS on

'order.productid=Products.productid where order.orderid=strorder

'hope this could help



  strSQL = "SELECT ecoles.categorie, ecoles.Etablissements,

table1.telephone "

  strSQL = strSQL & "FROM ecoles INNER JOIN table1 on ecoles.ID 

table1.ID "

  strSQL = strSQL & "WHERE (ecoles.ville = '" & strDirector & "') "

  strSQL = strSQL & "ORDER BY ecoles.ville "



objRS.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly,

adCmdText



If objRS.EOF Then

Response.Write "The database does not contain any films by the director "

& strDirector

  Else

Response.write "<H2>Directed by " & strDirector & ":</H2>"

do while not objRS.EOF

[ Response.Write "<B>Summary:</B> " & objRS("ecoles.categorie") & "<BR>" & _ ]

"<B>Summary:</B> " & objRS("ecoles.Etablissements") & "<BR>" & _

"<B>Genre:</B> " & objRS("table1.telephone") & "<BR><BR><BR>"

objRS.MoveNext 'This is the important bit... If this ins't there you will

'continually print out the same record and tie up your database server.

loop

  End If

  objRS.Close

  Set objRS = Nothing

%>



Message #2 by "Ken Schaefer" <ken@a...> on Thu, 16 Nov 2000 13:02:19 +1100
What is the error message?



Cheers

Ken



----- Original Message -----

From: "baba" <abdelramli@y...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, November 16, 2000 2:51 AM

Subject: [asp_databases] Database query using Inner join , please help





> if anyone could help me in making the following basic codes work

>  it is the line under barcket that is causing troubles (according to the

> error message displayed on the browser.

> I'm simply trying to use Inner join

> Your help would be, as always, extremely appreciated.

>

> <%

>   Dim strDirector, strCountry, strCriteria

>   strDirector = Request.Form("director")

>   strcountry = Request.Form("Country")

>

>   Dim objRS

>   Set objRS = Server.CreateObject("ADODB.Recordset")

>

> 'select order.orderid, order.productid from ORDERS INNERJOIN PRODUCTS on

> 'order.productid=Products.productid where order.orderid=strorder

> 'hope this could help

>

>   strSQL = "SELECT ecoles.categorie, ecoles.Etablissements,

> table1.telephone "

>   strSQL = strSQL & "FROM ecoles INNER JOIN table1 on ecoles.ID 

> table1.ID "

>   strSQL = strSQL & "WHERE (ecoles.ville = '" & strDirector & "') "

>   strSQL = strSQL & "ORDER BY ecoles.ville "

>

> objRS.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly,

> adCmdText

>

> If objRS.EOF Then

> Response.Write "The database does not contain any films by the director "

> & strDirector

>   Else

> Response.write "<H2>Directed by " & strDirector & ":</H2>"

> do while not objRS.EOF

> [ Response.Write "<B>Summary:</B> " & objRS("ecoles.categorie") & "<BR>" &

_ ]

> "<B>Summary:</B> " & objRS("ecoles.Etablissements") & "<BR>" & _

> "<B>Genre:</B> " & objRS("table1.telephone") & "<BR><BR><BR>"

> objRS.MoveNext 'This is the important bit... If this ins't there you will

> 'continually print out the same record and tie up your database server.

> loop

>   End If

>   objRS.Close

>   Set objRS = Nothing

> %>

>





Message #3 by "abdelramli" <abdelramli@y...> on Thu, 16 Nov 2000 08:55:21 +0100
Thank for your help Ken, here is the error message



ADODB.Fields erreur '800a0cc1'



ADO could not find the object in the collection corresponding to the name or

ordinal reference requested by the application.



/begasp/finddirector.asp, ligne 37







----- Original Message -----

From: "Ken Schaefer" <ken@a...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, November 16, 2000 3:02 AM

Subject: [asp_databases] Re: Database query using Inner join , please help





> What is the error message?

>

> Cheers

> Ken

>

> ----- Original Message -----

> From: "baba" <abdelramli@y...>

> To: "ASP Databases" <asp_databases@p...>

> Sent: Thursday, November 16, 2000 2:51 AM

> Subject: [asp_databases] Database query using Inner join , please help

>

>

> > if anyone could help me in making the following basic codes work

> >  it is the line under barcket that is causing troubles (according to the

> > error message displayed on the browser.

> > I'm simply trying to use Inner join

> > Your help would be, as always, extremely appreciated.

> >

> > <%

> >   Dim strDirector, strCountry, strCriteria

> >   strDirector = Request.Form("director")

> >   strcountry = Request.Form("Country")

> >

> >   Dim objRS

> >   Set objRS = Server.CreateObject("ADODB.Recordset")

> >

> > 'select order.orderid, order.productid from ORDERS INNERJOIN PRODUCTS on

> > 'order.productid=Products.productid where order.orderid=strorder

> > 'hope this could help

> >

> >   strSQL = "SELECT ecoles.categorie, ecoles.Etablissements,

> > table1.telephone "

> >   strSQL = strSQL & "FROM ecoles INNER JOIN table1 on ecoles.ID 

> > table1.ID "

> >   strSQL = strSQL & "WHERE (ecoles.ville = '" & strDirector & "') "

> >   strSQL = strSQL & "ORDER BY ecoles.ville "

> >

> > objRS.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly,

> > adCmdText

> >

> > If objRS.EOF Then

> > Response.Write "The database does not contain any films by the director

"

> > & strDirector

> >   Else

> > Response.write "<H2>Directed by " & strDirector & ":</H2>"

> > do while not objRS.EOF

> > [ Response.Write "<B>Summary:</B> " & objRS("ecoles.categorie") & "<BR>"

&

> _ ]

> > "<B>Summary:</B> " & objRS("ecoles.Etablissements") & "<BR>" & _

> > "<B>Genre:</B> " & objRS("table1.telephone") & "<BR><BR><BR>"

> > objRS.MoveNext 'This is the important bit... If this ins't there you

will

> > 'continually print out the same record and tie up your database server.

> > loop

> >   End If

> >   objRS.Close

> >   Set objRS = Nothing

> > %>

> >

>

>

>
Message #4 by "Ken Schaefer" <ken@a...> on Fri, 17 Nov 2000 11:24:13 +1100
a) Make sure that all the fields that you are using are actually in the

database and you haven't misspelt any of them



b) Instead of doing objRS("ecoles.ville"), just do objRS("ville")



HTH



Cheers

Ken



----- Original Message -----

From: "abdelramli" <abdelramli@y...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, November 16, 2000 6:55 PM

Subject: [asp_databases] Re: Database query using Inner join , please help





> Thank for your help Ken, here is the error message

>

> ADODB.Fields erreur '800a0cc1'

>

> ADO could not find the object in the collection corresponding to the name

or

> ordinal reference requested by the application.

>

> /begasp/finddirector.asp, ligne 37

>

>

>

> ----- Original Message -----

> From: "Ken Schaefer" <ken@a...>

> To: "ASP Databases" <asp_databases@p...>

> Sent: Thursday, November 16, 2000 3:02 AM

> Subject: [asp_databases] Re: Database query using Inner join , please help

>

>

> > What is the error message?

> >

> > Cheers

> > Ken

> >

> > ----- Original Message -----

> > From: "baba" <abdelramli@y...>

> > To: "ASP Databases" <asp_databases@p...>

> > Sent: Thursday, November 16, 2000 2:51 AM

> > Subject: [asp_databases] Database query using Inner join , please help

> >

> >

> > > if anyone could help me in making the following basic codes work

> > >  it is the line under barcket that is causing troubles (according to

the

> > > error message displayed on the browser.

> > > I'm simply trying to use Inner join

> > > Your help would be, as always, extremely appreciated.

> > >

> > > <%

> > >   Dim strDirector, strCountry, strCriteria

> > >   strDirector = Request.Form("director")

> > >   strcountry = Request.Form("Country")

> > >

> > >   Dim objRS

> > >   Set objRS = Server.CreateObject("ADODB.Recordset")

> > >

> > > 'select order.orderid, order.productid from ORDERS INNERJOIN PRODUCTS

on

> > > 'order.productid=Products.productid where order.orderid=strorder

> > > 'hope this could help

> > >

> > >   strSQL = "SELECT ecoles.categorie, ecoles.Etablissements,

> > > table1.telephone "

> > >   strSQL = strSQL & "FROM ecoles INNER JOIN table1 on ecoles.ID 

> > > table1.ID "

> > >   strSQL = strSQL & "WHERE (ecoles.ville = '" & strDirector & "') "

> > >   strSQL = strSQL & "ORDER BY ecoles.ville "

> > >

> > > objRS.Open strSQL, strConnect, adOpenForwardOnly, adLockReadOnly,

> > > adCmdText

> > >

> > > If objRS.EOF Then

> > > Response.Write "The database does not contain any films by the

director

> "

> > > & strDirector

> > >   Else

> > > Response.write "<H2>Directed by " & strDirector & ":</H2>"

> > > do while not objRS.EOF

> > > [ Response.Write "<B>Summary:</B> " & objRS("ecoles.categorie") &

"<BR>"

> &

> > _ ]

> > > "<B>Summary:</B> " & objRS("ecoles.Etablissements") & "<BR>" & _

> > > "<B>Genre:</B> " & objRS("table1.telephone") & "<BR><BR><BR>"

> > > objRS.MoveNext 'This is the important bit... If this ins't there you

> will

> > > 'continually print out the same record and tie up your database

server.

> > > loop

> > >   End If

> > >   objRS.Close

> > >   Set objRS = Nothing

> > > %>

> > >

> >

> >

> 

  Return to Index