Can i use @ symbol for bind variables instead of colon for O

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
[email protected]
Posts: 1
Joined: Wed 15 Jul 2009 07:14

Can i use @ symbol for bind variables instead of colon for O

Post by [email protected] » Wed 15 Jul 2009 07:18

Dear helpers,

Previously we are using sql server 2005 database(and visual studio as client) so the code to
retrieve data as follows

StringBuilder selectQuery = new StringBuilder();
selectQuery.Append("SELECT INTER_DIVISION_TRX_ON_SHIP ");
selectQuery.Append("FROM COR_DIV ");
selectQuery.Append("WHERE DIVISION_ID = @divisionId");

SqlConnection connection = null;
SqlCommand command = null;
SqlDataReader reader = null;
try
{
// get the connection and create the statement
connection = GetOpenConnection();
command = connection.CreateCommand();

command.CommandText = selectQuery.ToString();
DBUtil.SetIntParam(command, "@divisionId", divisionId);
interDivisionTrxOnShip = command.ExecuteScalar().ToString();
}
catch (Exception ex)
{

}

in DBUtil.SetIntParam method the code as follows
public static void SetIntParam(IDbCommand command, string paramName,
int paramValue)
{
IDbDataParameter param = command.CreateParameter();
param.ParameterName = paramName;
if (paramValue != int.MinValue)
{
param.Value = paramValue;
}
else
{
param.Value = DBNull.Value;
}

command.Parameters.Add(param);
}

Now we migrate our database to oracle 11g,so we need to use ODP.Net data provider,
now my problem is i need to follow the same syntax as described above without changing
@ symbol for bind variables can you please help me to satisfy my needs.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 15 Jul 2009 13:27

If you are using ODP.NET data provider, please visit ODP.NET forum. As for the dotConnect for Oracle syntax, parameters are declared using ':' prefix followed by the name of the parameter. For more information, please refer to http://www.devart.com/dotconnect/oracle ... Using.html , the Using Parameters section.

Post Reply