data retrieval in sql ce

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

Please what is: Table Direct mode with Seek on an index ?
And how to use it ?

Thank you
 
In the SqlCE Library, it's a mechanism that you can retrieve data a lot
faster than doing a regular Select statmenent with a WHERE Clause. Remember
though, while TableDirect is available w/ other providers, what I'm speaking
about here is specifically about CE.

Basically, you create a new command and specify the tablename

SqlCeCommand cmd = new SqlCeCommand("MyTableName", connection);
Next, specify the index

cmd.IndexName = "WhateverMyIndexNameIs";

Next, set the range...
cmd.SetRange(DbRangeOptions.InclusiveStart|DbRangeOptions.InclusiveEnd,
beginningValue, endingValue);

now, you execute your reader...

But instead of while(Reader.Read())

Use, Reader.Seek(DbSeekOptions.AfterEqual, firstvalue, secondValue) where
firstvalue and secondvalue correspond to the range you wanted to search on
in the index.

It's a faster way to grab data but from what I've seen, very very little
documentation on it. There is some stuff in BOL for Sql CE though.

Let me know if you have any furhter questions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top