tags:

views:

179

answers:

4

Does anybody know how to call a sql with a compute clause in C#? I got internal error 30016. my Database is sybase 12.5.4.

A: 

without more info, your best bet is to wrap it in a stored procedure, and just call that from C#

KM
A: 

the stored procedure does not for me because the sql is dynamic sql. But I don't know why ADO.NET does not support this.

Southsouth
This is not an answer, just extra information. However, you should edit your question and include this there...
KM
A: 

I don't see the reason why you couldn't just inline the SQL.

SqlCommand cmd = connection.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT SalesPersonID, CustomerID, OrderDate, SubTotal, TotalDue " +
    "FROM Sales.SalesOrderHeader " + 
    "ORDER BY SalesPersonID, OrderDate " + 
    "COMPUTE SUM(SubTotal), SUM(TotalDue) BY SalesPersonID";
A: 

I did the same way, but When call Adaper.Fill() I got internal error 30016

Southsouth