Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql command with Btrieve 6.15 on ASP

Status
Not open for further replies.

not24

Programmer
Feb 25, 2002
68
US
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.
 
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
 
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(&quot;test.clsDataAccess&quot;) is the component that I use for execute sql command. Other sql command are fine but not this one.

Please advice,
 
I'm not familiar with the &quot;test.clsDataAccess&quot; 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 &quot;Date&quot; 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
 
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 = &quot;select distinct Date as DateAdded &quot;
sql = sql & &quot;FROM table1 &quot;
sql = sql & &quot;WHERE RTRIM(table1.IDCODE) = '100' &quot;
sql = sql & &quot;OR RTRIM(table1.IDCODE) = '101' &quot;
sql = sql & &quot;order by DATE, TIME, LABEL&quot;

Double quotes didn't work and I don't think &quot;Date&quot; 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,
 
If you use the SQL &quot;select distinct Date as DateAdded from table1 WHERE (RTRIM(IDCode) = '100' or RTRIM(IDCode) = '101')&quot; 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
 
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,
 
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


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top