Closed avber closed 1 year ago
Given your error message of Unable to cast object of type 'System.String' to type 'System.Int32'.
My guess is that the table PostgreSQLTestTable
contains strings
not int
s. Like .net in general, Insight will not automatically coerce incompatible types.
Check to ensure that you have not created another table with the same name / value, as test code can often confuse you.
If that is not the case, please update with a full set of code and stack trace.
Jon,
I copied the code from the wiki. connection.ExecuteSql("CREATE TABLE PostgreSQLTestTable (p int)");
The only column contains integers.
Thanks
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hello,
I copied the following code almost verbatim from https://github.com/jonwagner/Insight.Database/wiki/PostgreSQL-Provider and received 'Unable to cast object of type 'System.String' to type 'System.Int32'.'
Steps to reproduce
using (var connection = new Repository().GetDbConnection().OpenWithTransaction()) { connection.ExecuteSql("CREATE TABLE PostgreSQLTestTable (p int)"); connection.ExecuteSql(@" CREATE OR REPLACE FUNCTION PostgreSQLTestProc (i int) RETURNS SETOF refcursor AS $$ DECLARE rs refcursor; BEGIN
In general, I have troubles getting data from functions with cursors.