0

I've read several other threads that point towards this article

http://msdn.microsoft.com/en-us/library/y7tz3hhk%28v=vs.80%29.aspx

However the example doesn't lend itself to what I want very well. I looked at a few other SQL statements, and I'm not sure I'm using it right. I'm connecting to a DBF file through C# with OleDbConnection and populating an OleDbDataAdapter

 var sql = "select *, recNo() as rownum from '" + Uri.UnescapeDataString(connString) 
+ "' WHERE (rownum > " + lowerLimit + ") AND (rownum > " + upperLimit + ")";

I keep receiving an error message saying that rownum doesn't exist. I tried changing the rownum to CAPS, no difference.

SQL: Column 'ROWNUM' is not found.

In summary, what I'm trying to accomplish is return all rows based on what row it's in. Modifying the DBF file is not an option, and I'd like to save on memory, so just adding everything into a giant table is not a fesible option. (600,000+ records)

Evan Parsons
  • 1,139
  • 20
  • 31

1 Answers1

2

Try using the RECNO() in the WHERE clause: WHERE RECNO() > var

Another option would be to use sub queries since rownum doesn't exist yet.

Jerry
  • 6,357
  • 8
  • 35
  • 50
  • Hmm, weird... nope, doesn't appear to be working, although my error message is gone. It's returning 10,000 less records than what the Database contains? record DBF count: 702240 record lower: 20000 record upper: 30000 – Evan Parsons Jun 25 '13 at 17:28
  • Disregard my last message, I had the limit boundaries wrong (hat for upper limit was facing wrong way) Thanks! – Evan Parsons Jun 25 '13 at 17:34