Solved

Error Type: Microsoft VBScript runtime (0x800A01A8) - Object required:

Posted on 2006-10-31
9
585 Views
Last Modified: 2012-06-21
<!--#include file="inc_conn.asp"-->

<%
Dim strSQL, rs, cmd
Dim bem
flag = false


'codigo = request.QueryString("bem")

strSQL = "select cidade.descricao as cidadedesc, bem.codigo as BemCodigo, bairro.descricao as bairrodesc, bem.endereco, bem.complemento, bem.valor_venda, bem.descricao, bem.modalidade , bem.tipo , bem.n_quartos, bem.n_suites, bem.n_vagas_carro, bem.valor_mensal, bem.valor_condominio, bem.m2 from cidade join bem on bem.idcidade = cidade.codigo join bairro on bairro.codigo = bem.idbairro where web_locar = 1 or web_vender = 1 and Bem.Codigo = "& bem

set cmd = Server.CreateObject("ADODB.Command")
set cmd.ActiveConnection = conn
cmd.CommandText = strSQL
set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.CursorType = 0
set rs = cmd.Execute

%>
0
Comment
Question by:nagib
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17843309
We need to know which line is throwing the error. I assume "conn" is being created in your include file, but it may be worth checking its contents to make sure it is creating the connection properly.
0
 

Author Comment

by:nagib
ID: 17843348
<!--#include file="inc_conn.asp"-->

<%
Dim strSQL, rs, cmd
Dim bem
flag = false


'codigo = request.QueryString("bem")

strSQL = "select cidade.descricao as cidadedesc, bem.codigo as BemCodigo, bairro.descricao as bairrodesc, bem.endereco, bem.complemento, bem.valor_venda, bem.descricao, bem.modalidade , bem.tipo , bem.n_quartos, bem.n_suites, bem.n_vagas_carro, bem.valor_mensal, bem.valor_condominio, bem.m2 from cidade join bem on bem.idcidade = cidade.codigo join bairro on bairro.codigo = bem.idbairro where web_locar = 1 or web_vender = 1 and Bem.Codigo = "& bem

set cmd = Server.CreateObject("ADODB.Command")
set cmd.ActiveConnection = conn
cmd.CommandText = strSQL
set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.CursorType = 0
set rs = cmd.Execute

response.write rs(bem.codigo)   'THIS LINE IS THROWING THE ERROR
'response.write rs(bem.codigo)
response.end

%>
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17843366
Aah, you need to put the name of the column in quotes:

    Response.Write rs("bem.codigo")
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:nagib
ID: 17843370
INC_CONN.ASP FILE

<%
Dim conn
      set conn = server.CreateObject("ADODB.Connection")

      with conn
            .connectionstring = "Provider=SQLOLEDB.1;Password=**********;Persist Security Info=False;User ID=sa;Initial Catalog=Simobil_Etica;Data Source=nma\nma"
            .open
      end with

%>
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17843386
nagib,

If Carl's solution doesn't work then try using the alias instead.  You set up bem.codigo to the alias BemCodigo.  Try using the line below.

Response.Write rs("BemCodigo")

At least partial credit to Carl though because the missing quotes were a problem even if the alias works.

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17843403
Ah so he did, didn't notice that. I should probably read the question properly rather than just scanning it :o)
0
 

Author Comment

by:nagib
ID: 17843409
Now I get
ADODB.Recordset (0x800A0CC1)
and changing to the alias it worked, but gave me the wrong answer to the response.write rs("BemCodigo") this is my major problem.
Its returning 21 while it shoud return 1254....
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 125 total points
ID: 17843426
You should Response.Write your full query and then run it in Enterprise Manager to verify what data is returned. It seems very odd that it should output something other than what is in the database.
0
 

Author Comment

by:nagib
ID: 17843689
Guys,
The strSQL was returning a large number of lines and the line number one had the BemCodigo=21.
I changes the strSQL to:

strSQL = "select cidade.descricao as cidadedesc, bem.codigo, bairro.descricao as bairrodesc, bem.endereco, bem.complemento, bem.valor_venda, bem.descricao, bem.modalidade , bem.tipo , bem.n_quartos, bem.n_suites, bem.n_vagas_carro, bem.valor_mensal, bem.valor_condominio, bem.m2 from cidade join bem on bem.idcidade = cidade.codigo join bairro on bairro.codigo = bem.idbairro where (web_locar = 1 or web_vender = 1) and bem.codigo = "& bem

I added the parentesis to solve the problem.

Thanks.

Who should I give the credit to ?  I think I should give to CARL_TAWN....
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question