Forum: Building VoltDB Clients

Post: C# and retrieving data from stored procedure

C# and retrieving data from stored procedure
Nikpraskaton
Dec 15, 2012
Hi,
I have table Towns with some random towns in it and I wold like to retrieve all data from that table in my C# application.
When i retrieve data i would like to work with them and eventually change them and store them back in Towns table.
I have a procedure:
import org.voltdb.*;

public class procSelect extends VoltProcedure {

public final SQLStmt getAll = new SQLStmt(
"SELECT FROM towns ;"
);

public VoltTable[] run()
throws VoltAbortException {
voltQueueSQL( getAll );
return voltExecuteSQL();
}
}

for that procedure I wrote this wrapper:

var select = conn.Procedures.Wrap<Table[]>("procSelect");

How and where can i store the result (all table rows) from that table?

Thanks
bballard
Dec 18, 2012
Hi,

First, I think you need the query to read "SELECT * FROM towns;".

I'm not sure exactly what you want to do as far as storing the result from this procedure, but it sounds like maybe you are looking for how to consume the response from the procedure in C#. I have a draft blog post on github that I've compiled from our C# webinar and previous C# blog posts. It think the last section on consuming results may have some examples that might help.

https://github.com/benjaminballard/voltdb_docs/blob/master/blogs/c_sharp_driver_notes.md

Best regards,
Ben
Tcruise02
Feb 10, 2015
There a bug the VoltResponse class if you have a request that's timed out there is no data in the instance's table object, so the __str__ method throws a TypeError exception.

I have a patch for the python client on github, but it looks like you can't submit patches to your client from there.