Solved

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

Posted on 2006-10-31
9
584 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
Industry Leaders: 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

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to get statistic's from a competitors website?! 1 128
Recordset containing single quotes 8 49
Obtain data from database .mdb 4 30
Validating Date 4 29
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

733 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