Solved

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

Posted on 2006-10-31
9
581 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
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 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