0

i have this code for fast search. it work excellent in sqlCE

SqlCeCommand Cmd;
Cmd.CommandType = CommandType.TableDirect;
Cmd.CommandText = "MEN";
Cmd.IndexName = "A";
Cmd.SetRange(DbRangeOptions.Match, new object[] { R[15].ToString().Trim(), MyDate }, null);
SqlCeDataReader read = Cmd.ExecuteReader();
while (read.Read())
{
  TmpBAR = read[0].ToString();
}
read.Dispose();
if (TmpBAR == "")
{
  //return false;
}

i try to convert to oracle like this:

OracleCommand Cmd;
Cmd.CommandType = CommandType.TableDirect;
Cmd.CommandText = "MEN";
Cmd.IndexName = "A";
Cmd.SetRange(DbRangeOptions.Match, new object[] { R[15].ToString().Trim(), MyDate }, null);
OracleDataReader read = Cmd.ExecuteReader();
while (read.Read())
{
  TmpBAR = read[0].ToString();
}
read.Dispose();
if (TmpBAR == "")
{
  //return false;
 }

and i get error:

System.Data.OracleClient.OracleCommand' does not contain a definition for 'IndexName' and no extension method 'IndexName' accepting a first argument of type 'System.Data.OracleClient.OracleCommand' could be found (are you missing a using directive or an assembly reference?)

and this error:

System.Data.OracleClient.OracleCommand' does not contain a definition for 'SetRange' and no extension method 'SetRange' accepting a first argument of type 'System.Data.OracleClient.OracleCommand' could be found (are you missing a using directive or an assembly reference?)

2 Answers 2

2

You will need to use CommandType.Text and create an appropriate SQL statement to select from the table MEN. The functionality you are currently using is SQLCE specific and is not supported by the ORACLE provider.

You should not worry about specifying the index name, the ORACLE SQL optimizer will automatically select the appropriate index, assuming one exists.

I would also suggest that you do not use the Microsoft provided ORACLE provider, since this is deprecated in Framework 4.0. The ORACLE provider from Oracle is very good.

ODP.NET - http://www.oracle.com/technetwork/database/windows/downloads/index-101290.html

Sign up to request clarification or add additional context in comments.

Comments

0

The Oracle ADO.NET components are different than the SQL CE components. I would suggest casting everything to an IDbCommand interface if you need to be able to support both providers and you'll get the set of functionality that needs to be supported by both providers. If you don't need to support both providers, you'll just have to find a different syntax to do the same thing in the Oracle Command object.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.