Page 1 of 1

problem filling dataset

Posted: Fri 02 Sep 2005 21:26
by daniela
hi
I 've created a function sp_getText that returns a set of my detined type (named result_text) in postgre database.
I create a conn, command and dataAdapter in the c#net.

Code: Select all

PgSqlParameter param = null;
param = new PgSqlParameter( ,  )
param.Direction = ParameterDirection.Input;		
param.PgSqlType = PgSqlType.VarChar;

param = new PgSqlParameter( ,  )
param.Direction = ParameterDirection.Input;		
param.PgSqlType = PgSqlType.Int;


command.Parameters.Add(param);
			
//set the stored procedure name
command.CommandText = "sp_getText";
command.CommandType = CommandType.StoredProcedure;

dataAdapter = new PgSqlDataAdapter(command);

DataSet tmpDs = new DataSet();
//fill the data in the required data table
dataAdapter.Fill(tmpDs,"test");
On the last line i'm getting this error:

Code: Select all

System.FormatException: Input string was not in a correct format.

Code: Select all

Stack trace:
[FormatException: Input string was not in a correct format.]
   CoreLab.PostgreSql.PgSqlCommand.a(CommandBehavior A_0, IDisposable A_1, Int32 A_2, Int32 A_3)
   CoreLab.Common.DbCommandBase.b(CommandBehavior A_0)
   CoreLab.Common.DbCommand.a(CommandBehavior A_0)
   System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
   Seavus.DataBaseTier.DBBase.executeResults(String procName, Hashtable inParamTypes, Hashtable inParamValues, String srcTable) in e:\seavus\korthuset-postgre\svsdatabasetier\dbbase.cs:83
   Seavus.DataBaseTier.DBText.getLanguageText(String page, Int32 language) in e:\seavus\korthuset-postgre\svsdatabasetier\dbtext.cs:35
   korthuset_net.index.setMasterText() in E:\Seavus\Korthuset-postgre\index.aspx.cs:87
   korthuset_net.index.Page_Load(Object sender, EventArgs e) in E:\Seavus\Korthuset-postgre\index.aspx.cs:38
   System.Web.UI.Control.OnLoad(EventArgs e)
   System.Web.UI.Control.LoadRecursive()
   System.Web.UI.Page.ProcessRequestMain()
Can you tell me what an i doing wrong? I'm new in postgre database development :)

Regards
Daniela

Problem filling dataset

Posted: Mon 05 Sep 2005 05:46
by Yuri
Please send us complete script to create stored procedure and specify the parameter value.