Invalid character for ; using reader.NextResult

Total Post:88

Points:616

C# 
C#
 2108  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. 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

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.