[Mono-list] Generics and PostgreSQL

Cafer Simsek cafer at pazar.com
Mon May 24 15:37:38 EDT 2010


Here is the code example: 

private void test()
{
	string sql = "select * from invoices where integrated = 0 order by date
asc";
	string cs = "user
id=billing;password=billing;server=10.0.3.5;database=billing";
	IGenericSQLHelper helper = new GenericSQLHelper<NpgsqlConnection,
NpgsqlDataAdapter, NpgsqlCommand>(cs);
	DataSet ds = helper.ExecuteDataSet(sql);
	MessageBox.Show("count: " + ds.Tables[0].Rows.Count);
}

and the exception's stack trace is:

System.NullReferenceException: Object reference not set to an instance
of an object
  at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet,
Int32 startRecord, Int32 maxRecords, System.String srcTable, IDbCommand
command, CommandBehavior behavior) [0x00000] 
  at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet)
[0x00000] 
  at
System.Data.GenericSQLHelper`3[Npgsql.NpgsqlConnection,Npgsql.NpgsqlDataAdapter,Npgsql.NpgsqlCommand].ExecuteDataSet (System.String sqlCommandText, System.Data.Common.DbParameter[] args, System.String TransactionId) [0x000dd] in /media/SAMSUNG/projeler/integration/integration/GenericSQLHelper.cs:182 
  at
System.Data.GenericSQLHelper`3[Npgsql.NpgsqlConnection,Npgsql.NpgsqlDataAdapter,Npgsql.NpgsqlCommand].ExecuteDataSet (System.String sqlCommandText) [0x00000] in /media/SAMSUNG/projeler/integration/integration/GenericSQLHelper.cs:153 
  at integration.Form1.test () [0x00013]
in /media/SAMSUNG/projeler/integration/integration/Form1.cs:38 
  at integration.Form1.button1_Click (System.Object sender,
System.EventArgs e) [0x00000]
in /media/SAMSUNG/projeler/integration/integration/Form1.cs:61 
  at System.Windows.Forms.Control.OnClick (System.EventArgs e)
[0x00000] 
  at System.Windows.Forms.Button.OnClick (System.EventArgs e) [0x00000] 
  at System.Windows.Forms.ButtonBase.OnMouseUp
(System.Windows.Forms.MouseEventArgs mevent) [0x00000] 
  at System.Windows.Forms.Button.OnMouseUp
(System.Windows.Forms.MouseEventArgs mevent) [0x00000] 
  at System.Windows.Forms.Control.WmLButtonUp
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message&
m) [0x00000] 
  at System.Windows.Forms.ButtonBase.WndProc
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.Button.WndProc (System.Windows.Forms.Message&
m) [0x00000] 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc
(System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg,
IntPtr wParam, IntPtr lParam) [0x00000] 


Best Regards.


-- 
Cafer Şimşek
http://pazar.com/


Pzt, 2010-05-24 tarihinde 14:13 -0300 saatinde, Francisco Figueiredo Jr.
yazdı:
> On Mon, May 24, 2010 at 06:18, Cafer Simsek <cafer at pazar.com> wrote:
> > Hi All,
> >
> 
> Hi Cafer!
> 
> > I'm very new to Mono.
> >
> > I want to migrate one of my projects to Mono. The project uses two SQL
> > Client (MsSQL and PostgreSQL), and has a GenericSQLHelper class:
> > http://codepaste.net/5g9ye4
> >
> > When using MsSQL with this helper (mssqlHelper = new
> > GenericSQLHelper<SqlConnection, SqlDataAdapter, SqlCommand>(cs_mssql);)
> > working great but it's not working on any PostgreSQL client that I've
> > tested (Npgsql and Devart's PostgreSQL client).
> >
> > It throws an exception on line 182 (GenericSQLHelper.cs).
> >
> > It's working great on MS .Net Framework. And it also working on Mono
> > when using plain method (without generics).
> >
> 
> Do you have a working example which shows the problem?
> 
> Which error are you getting?
> 
> Thanks in advance.
> 
> 
> 
> 



More information about the Mono-list mailing list