From: JS.staff <jsp...@ec...> - 2004-02-18 13:41:14
|
Thanks for the quick reply. This duplicates my problem. I'm sure I'm = doing (or not doing!) something dumb! Uses a simple table, TESTTABLE (id integer, username varchar(50)) Thanks, John //////////////////////////////////////////// private void tester() { FbCommand sel =3D new FbCommand("select id,username from = testtable",fbConnection1); FbCommand upd =3D new FbCommand("update testtable set username =3D = @username where id =3D @id",fbConnection1); FbCommand ins =3D new FbCommand("insert into testtable values = (@id,@username)",fbConnection1); FbCommand del =3D new FbCommand("delete from testtable where id =3D = @id",fbConnection1); upd.Parameters.Add("@username",FbDbType.VarChar); upd.Parameters.Add("@id",FbDbType.Integer); ins.Parameters.Add("@username",FbDbType.VarChar); ins.Parameters.Add("@id",FbDbType.Integer); del.Parameters.Add("@username",FbDbType.VarChar); del.Parameters.Add("@id",FbDbType.Integer); FbDataAdapter adap =3D new FbDataAdapter(); adap.SelectCommand =3D sel; adap.UpdateCommand =3D upd; adap.InsertCommand =3D ins; adap.DeleteCommand =3D del; fbConnection1.Open(); try { FbTransaction trans =3D = fbConnection1.BeginTransaction(IsolationLevel.RepeatableRead); try { sel.Transaction =3D trans; upd.Transaction =3D trans; ins.Transaction =3D trans; del.Transaction =3D trans; adap.Update(dataSet1,"something"); // which requires an update call trans.Commit(); } catch { trans.Rollback(); throw; } } finally { fbConnection1.Close(); } } /////////////////////////////////////////////// -----Original Message----- From: Carlos Guzm=E1n =C1lvarez [mailto:car...@te...]=20 Sent: 18 February 2004 12:37 To: JS.staff Cc: fir...@li... Subject: Re: [Firebird-net-provider] Using FbDataAdapter in VS 2003 Hello: > "NullReferenceException: object not set to an instance of an object" >=20 > Both Update and Insert command objects are specified. Any ideas? Can you send a test case ?? -- Best regards Carlos Guzm=E1n =C1lvarez Vigo-Spain |
From: JS.staff <jsp...@ec...> - 2004-02-18 15:48:42
|
If I use the FbCommandBuilder to produce update/insert/delete commands = it works fine.....!! Help! John -----Original Message----- From: JS.staff=20 Sent: 18 February 2004 13:39 To: fir...@li... Subject: RE: [Firebird-net-provider] Using FbDataAdapter in VS 2003 Thanks for the quick reply. This duplicates my problem. I'm sure I'm = doing (or not doing!) something dumb! Uses a simple table, TESTTABLE (id integer, username varchar(50)) Thanks, John //////////////////////////////////////////// private void tester() { FbCommand sel =3D new FbCommand("select id,username from = testtable",fbConnection1); FbCommand upd =3D new FbCommand("update testtable set username =3D = @username where id =3D @id",fbConnection1); FbCommand ins =3D new FbCommand("insert into testtable values = (@id,@username)",fbConnection1); FbCommand del =3D new FbCommand("delete from testtable where id =3D = @id",fbConnection1); upd.Parameters.Add("@username",FbDbType.VarChar); upd.Parameters.Add("@id",FbDbType.Integer); ins.Parameters.Add("@username",FbDbType.VarChar); ins.Parameters.Add("@id",FbDbType.Integer); del.Parameters.Add("@username",FbDbType.VarChar); del.Parameters.Add("@id",FbDbType.Integer); FbDataAdapter adap =3D new FbDataAdapter(); adap.SelectCommand =3D sel; adap.UpdateCommand =3D upd; adap.InsertCommand =3D ins; adap.DeleteCommand =3D del; fbConnection1.Open(); try { FbTransaction trans =3D = fbConnection1.BeginTransaction(IsolationLevel.RepeatableRead); try { sel.Transaction =3D trans; upd.Transaction =3D trans; ins.Transaction =3D trans; del.Transaction =3D trans; adap.Update(dataSet1,"something"); // which requires an update call trans.Commit(); } catch { trans.Rollback(); throw; } } finally { fbConnection1.Close(); } } /////////////////////////////////////////////// -----Original Message----- From: Carlos Guzm=E1n =C1lvarez [mailto:car...@te...]=20 Sent: 18 February 2004 12:37 To: JS.staff Cc: fir...@li... Subject: Re: [Firebird-net-provider] Using FbDataAdapter in VS 2003 Hello: > "NullReferenceException: object not set to an instance of an object" >=20 > Both Update and Insert command objects are specified. Any ideas? Can you send a test case ?? -- Best regards Carlos Guzm=E1n =C1lvarez Vigo-Spain ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! = http://ads.osdn.com/?ad_id=1356&alloc_id438&op=3Dick _______________________________________________ Firebird-net-provider mailing list = Fir...@li... https://lists.sourceforge.net/lists/listinfo/firebird-net-provider |
From: Carlos G. A. <car...@te...> - 2004-02-18 16:10:47
|
Hello: > If I use the FbCommandBuilder to produce update/insert/delete commands it= works fine.....!! ok, i will test your test case in one or two hours and i will comment the result. -- Best regards Carlos Guzm=C3=A1n =C3=81lvarez Vigo-Spain |
From: JS.staff <jsp...@ec...> - 2004-02-18 17:15:21
|
SGkgVG9ueSwNCiANClllYWggdGhlIGRhdGFzZXQgaXMgYmVpbmcgaW5pdGlhbGlzZWQgYnkgY29k ZSBtYWRlIGJ5IFZpc3VhbCBTdHVkaW8gLSBpdCBmaWxscyBmaW5lIChhbmQgdXBkYXRlcywgZGVs ZXRlcyBhbmQgaW5zZXJ0cyB3aGVuIHVzaW5nIHRoZSBGYkNvbW1hbmRCdWlsZGVyKS4gSnVzdCBu b3Qgd2l0aCBtYW51YWxseSB3cml0dGVuIFNRTC4NCiANCkkgdXNlZCB0byB1c2UgRGVscGhpIGFs bCB0aGUgdGltZSwgZ3JlYXQgbGFuZ3VhZ2UgLSBwaXR0eSBpdCdzIG5vdCBtb3JlIHBvcHVsYXIu DQogDQpDIyBkb2VzIGhhdmUgc29tZSBhZHZhbnRhZ2VzIHRob3VnaC4gTGlrZSB0aGUgIldoYXQg dGhlIGhlbGwgZG9lcyAqdGhhdCogbWVhbj8/PyIgZWZmZWN0IHdoZW4geW91ciBib3NzIGxvb2tz IG92ZXIgeW91ciBzaG9sZGVyLiA7KQ0KIA0KVGhhbmtzLA0KIA0KSm9obg0KDQoJLS0tLS1Pcmln aW5hbCBNZXNzYWdlLS0tLS0gDQoJRnJvbTogVG9ueSBSaXYgW21haWx0bzp0b255QHNvbWV3aGVy ZS5jb21dIA0KCVNlbnQ6IFdlZCAxOC8wMi8yMDA0IDE2OjI5IA0KCVRvOiBmaXJlYmlyZC1uZXQt cHJvdmlkZXJAbGlzdHMuc291cmNlZm9yZ2UubmV0IA0KCUNjOiANCglTdWJqZWN0OiBSZTogW0Zp cmViaXJkLW5ldC1wcm92aWRlcl0gVXNpbmcgRmJEYXRhQWRhcHRlciBpbiBWUyAyMDAzDQoJDQoJ DQoNCglEb24ndCBrbm93IGlmIHRoaXMgaGVscHMgb3IgaXMgcmVsZXZhbnQsIGJ1dCB3aGVuIHlv dSB1c2UgdGhlICAuRmlsbCh4LHkpLA0KCUhhdmUgeW91IGluaXRpYWxpc2VkIHRoZSB4IGJlZm9y ZWhhbmQNCgkNCglJbiBEZWxwaGkgKFNvcnJ5IGl0cyBpbiBEZWxwaGkpIHlvdSBoYXZlIHRvIHRv IGRvIHRoZSBmb2xsb3dpbmcuLi4NCgkgeCA6PSBEYXRhU2V0LkNyZWF0ZTsNCglNeURhdGFBZGFw LkZpbGwoeCwnVEVTVCcpOw0KCQ0KDQo= |
From:
<car...@te...> - 2004-02-18 17:54:39
|
Hello: >Yeah the dataset is being initialised by code made by Visual Studio - it >fills fine (and updates, deletes and inserts when using the FbCommandBuilder). >Just not with manually written SQL. I think i know where is the problem but i need to make a test using SqlClient too check how is working with it. -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From:
<car...@te...> - 2004-02-19 12:16:33
|
Hello: > It seems setting the SourceColumn of the FbParameters fixes the problem! Knew I was forgetting something stupid. > > It all works fine now (using your latest .dll 1.5.1509.41448). Great!! i will commit the changes into the CVS later today -- Best regards Carlos Guzmán Álvarez Vigo-Spain |