icorderoDSP
icorderoDSP

Reputation: 1

Updating database ODP Oracle.Net Error ORA 01008

Hello this question was answered a couple of years ago but its not been active for sometime. When i run the example with my values its giving me a ORA 01008 error but the "therow" values are bounded.

     List<string> fldList = new List<string>();

    using (OdbcConnection dbConnection = new OdbcConnection("Driver={Microsoft ODBC for Oracle};ConnectString=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = x.x.x.xxx)(PORT = xxx)))(CONNECT_DATA =(SERVICE_NAME = xxxx)));UID=xxxx;PWD=xxx;");)
    {
      dbConnection.Open();
      OracleCommand dbCommand2 = dbConnection.CreateCommand();
      dbCommand2.CommandType = CommandType.Text;
      dbCommand2.CommandText = "update MYTABLE set estatustrama = 2 where rowid = :therow ";
      dbCommand2.Parameters.AddWithValue("therow", fldList[fldList.Count-1]);

      dbCommand2.ExecuteNonQuery();
   }

Upvotes: 0

Views: 103

Answers (1)

Andrey Belykh
Andrey Belykh

Reputation: 2654

You are not using ODP.Net. The code you have is using ODBC. For ODBC you cannot use named parameters, only positional. :therow should be changed to ?.

Upvotes: 1

Related Questions