INVALID CHARACTER FOR ; USING READER.NEXTRESULT

jacob rasel

Total Post:88

Points:616
Posted by  jacob rasel
C# 
C#
 1585  View(s)
Ratings:
Rate this:

string sql = @"SELECT sum(subtotal) FROM table1 WHERE clientid=:v1;" +

"SELECT * FROM table2  WHERE clientid = :v2 "

cmd = DBConnection.GetCommand();

cmd.CommandText = sql;

cmd.Parameters.Clear();

cmd.Parameters.Add(":v1", "Name1");

cmd.Parameters.Add(":v2", "Name2");

OracleDataReader reader = cmd.ExecuteReader(); //Error: Invalid Character

while (reader.Read())

{

  ..results from first query

}

reader.NextResult();

while (reader.Read())

{

  ..results from second query

}

.NET is not allowing reader.NextResults using binding variables? Why i am getting Invalid Character?

  1. Pravesh Singh

    Post:412

    Points:2888
    Re: Invalid character for ; using reader.NextResult

    Hi Jacob,

    Remove the : when adding parameters to the command.

    cmd.Parameters.Add("v1", "Name1");

    cmd.Parameters.Add("v2", "Name2");

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!