New Posts New Posts RSS Feed: Parameter Passing in PassthruRdbQuery
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Parameter Passing in PassthruRdbQuery

 Post Reply Post Reply
Author
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Topic: Parameter Passing in PassthruRdbQuery
    Posted: 17-Oct-2007 at 1:09pm

I believe you’re using a DbParameter typed parameter in the PassthruRdbQuery.  You must use the RdbParameter type via ParameterizedSql instead for remoting PassthruRdbQuery.  See RdbParameter’s help:

 

  /// <remarks>

  /// An <b>RdbParameter</b> is essentially a <see cref="DbParameter"/> that is marshalled by

  /// value rather by reference when passed to a remote Business Object Server.  The remoting channel

  /// used by the client does not allow two-way communication with the remote server, which a

  /// DbParameter as a MarshalByRefObject requires.

  /// <para>

  /// Use an <b>RdbParameter</b> when adding parameters to a <b>StoredProcRdbQuery</b> or

  /// <b>PassthruRdbQuery</b>.

  /// </para>

  /// </remarks>

 

Try this for your query and see if it works.

 

      RdbKey key = (RdbKey)mPm.GetDataSourceKey(typeof(DB_PERSONS));

 

      string lastName = "LAST_NAME";

      string parmName = key.AdoHelper.FormatParameterName(lastName);

      RdbParameter param = new RdbParameter(parmName, DbType.String);

      param.Value = "Anacker1%";

 

      string select = String.Format(

        "select * from \"DB_ADM\".\"DB_PERSONS\"" +

        "  where ((id <> 0) and (upper({0}) like upper({1}))) and (ROWNUM <= 500)",

        lastName, parmName);

      ParameterizedSql sql = new ParameterizedSql(select, param);

      PassthruRdbQuery query = new PassthruRdbQuery(typeof(DB_PERSONS), sql);

 

Let us know the result. Thanks

 

Back to Top
Customer View Drop Down
Senior Member
Senior Member
Avatar
User Submitted Questions to Support

Joined: 30-May-2007
Location: United States
Posts: 260
Post Options Post Options   Quote Customer Quote  Post ReplyReply Direct Link To This Post Posted: 17-Oct-2007 at 1:06pm

When we use 3-tier deployment and the client executes a PassthruRdbQuery with parameters like

select * from "DB_ADM"."DB_PERSONS" where ((id <> 0) and (upper("DB_ADM"."DB_PERSONS"."LAST_NAME") like upper(:v0))) and (ROWNUM <= 500) Params: :v0=Anacker1%,

we get the following error:

"Type 'Oracle.DataAccess.Client.OracleParameter' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute."

How should we avoid this error? This problem is rather urgent.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down