Home > DeveloperSection > Forums > Invalid character for ; using reader.NextResult
jacob rasel
jacob rasel

Total Post:88

Posted on    February-09-2014 11:26 PM

 C# C# 

 1 Reply(s)
 1232  View(s)
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.Add(":v1", "Name1");

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

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

while (reader.Read())


  ..results from first query



while (reader.Read())


  ..results from second query


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

Pravesh Singh

Total Post:411

Posted on    February-09-2014 11:49 PM

Hi Jacob,

Remove the : when adding parameters to the command.

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

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

Don't want to miss updates? Please click the below button!

Follow MindStick