Solved

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

Posted on 2006-10-31
9
574 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
  • 4
  • 4
9 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
Comment Utility
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
Comment Utility
<!--#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
Comment Utility
Aah, you need to put the name of the column in quotes:

    Response.Write rs("bem.codigo")
0
 

Author Comment

by:nagib
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now