Reputation: 62424
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?)
Upvotes: 0
Views: 855
Reputation: 53699
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
Upvotes: 2
Reputation: 3461
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.
Upvotes: 0