[Gtk-sharp-list] GDA#

Rodrigo Moya rodrigo@novell.com
Mon, 05 Jul 2004 10:29:58 +0200


On Fri, 2004-07-02 at 21:18 +0200, Wolfgang Mauer wrote:
> Hi all,
> 
> at my program i do some like this
> 
> 			private Gda.DataModel kundendataset = null;
> 			...
> 
> 			for (int i = 0; i < this.kundendataset.NColumns; i++)
> 			{
> 				Gtk.Widget widget = null;
> 				string column = this.kundendataset.GetColumnTitle(i);
> 				widget = gxml.GetWidget(column);
> 				if (widget != null) 
> 				{
> Exception ---> 	       Gda.Value _value = this.kundendataset.GetValueAt(i, 0);
> 					if (widget.GetType() == typeof(Gtk.Entry))
> 					{ 
> 						((Gtk.Entry)gxml.GetWidget(column)).Text = _value.Stringify();
> 					} 
> 					else if (widget.GetType() == typeof(TextView))
> 					{ 
> 						((Gtk.TextView)gxml.GetWidget(column)).Buffer.Text = _value.Stringify();
> 					}
> 				} 
> 			}
> 
> my mysql table have 13 fields (all varchar)
> 
> i get a exception like this
> allways on a different column!!!!!!
> i also tryed 
> 					_value = this.kundendataset.GetRow(0).GetValue(i);
> 
> Unhandled Exception: System.NullReferenceException: Object reference not set 		
> to an instance of an object
> in (unmanaged) (wrapper managed-to-native) 
> System.Object:__icall_wrapper_mono_string_new_wrapper (intptr)
> in <0x00004> (wrapper managed-to-native) 
> System.Object:__icall_wrapper_mono_string_new_wrapper (intptr)
> in <0x001a6> (wrapper unknown) Gda.Value:PtrToStructure (intptr,object)
> in (unmanaged) (wrapper managed-to-native) 
> System.Runtime.InteropServices.Marshal:PtrToStructure (intptr,System.Type)
> in <0x00004> (wrapper managed-to-native) 
> System.Runtime.InteropServices.Marshal:PtrToStructure (intptr,System.Type)
> in <0x0008f> Gda.Value:New (intptr)
> in <0x00061> Gda.DataModel:GetValueAt (int,int)
> in <0x0012a> Assistent.KundenView:UpdateData (bool)
> 
> i this a bug ???
>
seems so, some people have reported it. I haven't had time to look at
it, but I'll do it shortly if nobody else does it before.

> i missing a method like SetValue ????
> how to store values back to row or datamodel ????
> 
for libgda 1.0, you need to run SQL queries on the server, via the
ExecuteNonQuery method. For 1.2, to be released in September, you'll be
able to use the DataModel methods directly, thus removing the need for
using SQL.

cheers