×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

sql command with Btrieve 6.15 on ASP

sql command with Btrieve 6.15 on ASP

sql command with Btrieve 6.15 on ASP

(OP)
I just start to write asp connect Btrieve 6.15. I wanted to search one field with 2 values following this:

select distinct Date as DateAdded from table1 WHERE (RTRIM(IDCode) = '100' or RTRIM(IDCode) = '101')

and I've got error following this:

Microsoft VBScript runtime (0x800A01A8)
Object required
test.asp, line 138

line 138 is "if rs.eof then"

But when I search with one value only. It seems show result fine.
select distinct Date as DateAdded from table1 WHERE (RTRIM(IDCode) = '100')

I don't know what's wrong with my sql command. It's pretty simple. I don't have a query tool for Btrieve. I have Btrieve 6.15, Pervasive ODBC installed that's all.

Please help.

RE: sql command with Btrieve 6.15 on ASP

Can you post your ASP code?  The error seems to indicate that the rs object doesn't exist.  

info@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician

RE: sql command with Btrieve 6.15 on ASP

(OP)
sql = "select distinct Date as DateAdded "
sql = sql & "FROM table1  "
sql = sql & "WHERE RTRIM(table1.IDCODE) = '100' OR RTRIM(table1.IDCODE) = '101'  "
sql = sql & "order by DATE, TIME, LABEL"

dim obj, rs
Set obj = Server.CreateObject("test.clsDataAccess")
Set rs = obj.GetData(ConnString, sql)
if rs.eof then
    ' no data
else
    while not rs.eof
        IDCODE = TRIM(rs.fields("IDCODE").value)
        DateAdded = TRIM(rs.fields("DateAdded").value)
        %>
        ..show data
        <%
        rs.movenext
    wend
    %>
    </table>
<%
end if
rs.close
set rs = nothing
set obj = nothing
%>

Set obj = Server.CreateObject("test.clsDataAccess") is the component that I use for execute sql command. Other sql command are fine but not this one.

Please advice,

RE: sql command with Btrieve 6.15 on ASP

I'm not familiar with the "test.clsDataAccess" component.  Is it something you've developed?  What happens if you use the standard ADO object in the ASP? DOes that work?  Can you post the connection string for the data base?  YOu have a field name called "Date" which is a SQL keyword. It's possible that ODBC is becoming confused.  I can't remember right off the top of my head but I know that with newer versions of Btrieve/Pervasive, you would put the field name in double quotes to get around that kind of problem.  Which brings me to the next question.  Why Btrieve v6.15?  It was never tested in WIndows 2000 and is very old (8 years old in fact) and is unsupported by Pervasive.  Have you considered upgrading to the newest version?  It comes with a much more robust ODBC driver and other enhancements.  THe Btrieve v6.15 ODBC is not thread safe and could cause problems with IIS.

info@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician

RE: sql command with Btrieve 6.15 on ASP

(OP)
Standard ADO object is way too slow - I tested it.

Here is ConnString:

Provider=MSDASQL.1;Persist Security Info=False;Data Source=mydsn1

test.clsDataAccess is the component I developed to execute sql command throught MTS (I don't know exactly the way to call it). It worked fine with other sql command and ConnString is corrected (I generated it from VB) - and I tested it. The component & ConnString also worked fine with the earlier sql command (without line 4):

sql = "select distinct Date as DateAdded "
sql = sql & "FROM table1  "
sql = sql & "WHERE RTRIM(table1.IDCODE) = '100' "
sql = sql & "OR RTRIM(table1.IDCODE) = '101'  "
sql = sql & "order by DATE, TIME, LABEL"

Double quotes didn't work and I don't think "Date" cause those problem because when I using above sql command (without line 4) it work but my problem is -- after I added line 4, it just keep error.

Why's Btrieve 6.15? Because the customer currently using another software that maintain this database. My script is just minor thing to read it from that database.

Please advice,

RE: sql command with Btrieve 6.15 on ASP

If you use the SQL "select distinct Date as DateAdded from table1 WHERE (RTRIM(IDCode) = '100' or RTRIM(IDCode) = '101')" with standard ADO objects, does that work?  If so, there's something up with your component that could be causing it.  If not, then what error is returned with the standard ADO object?

info@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician

RE: sql command with Btrieve 6.15 on ASP

(OP)
Yes, it does work. I can't really tell what's wrong with the compoent. Honestly, I'm not the original author. I just modified it to fit my need. and I didn't know that much about VB.
But thank you anyway. I'll try to check the component source code.

Thank you,

RE: sql command with Btrieve 6.15 on ASP

This is just a shot in the dark, but try changing
dim obj, rs

to
Dim obj as object
Dim rs as recordset
set rs = new Ado.recordset


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close