cancel
Showing results for 
Search instead for 
Did you mean: 

Multi result using HanaCommand in .NET

0 Kudos
383

Hi all, I want to get multiple select result while executing HanaCommand, but HANA DB throws a error: Sap.Data.Hana.HanaException (0x80004005): sql syntax error: incorrect syntax near "SELECT": line 2 col 1 (at pos 28)

when I'm doing like in the code below. Is it possible to put in there multiple queries to read many results?

using (var con = new HanaConnection(conString))
{
	con.Open();

	using var cmd = new HanaCommand(@"SELECT COUNT(*) FROM ITEM1;SELECT ID FROM ITEM2;", con);
	using var reader = cmd.ExecuteReader();
		
	while (reader.Read())
	{
		// do stuff
	}

	reader.NextResult();

	while (reader.Read())
	{
		// do stuff...
	}
}

Accepted Solutions (0)

Answers (0)