Don't call AcceptChanges until after the update.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Daniel Hahn
Sent: Monday, September 18, 2006 12:25 PM
To: For users and developers of the Firebird .NET providers
Subject: [Firebird-net-provider] database doesn't get updated after
adatadapter.update(..)
Hello all!
This is my first post to this list and here's some environment
information before asking my first question.
.NET 2.0, FirebirdClient 2.0, Visual Basic 2005 Express
I use the following code to fill a dataset from an dataadapter and
connect the table "CATEGORY" from the dataset to a datagridview:
Dataset_MIODB = New System.Data.DataSet()
Me.FbDataAdapter_CATEGORY.Fill(Me.Dataset_MIODB, "CATEGORY")
Me.DataGridView1.DataSource = Me.Dataset_MIODB
Me.DataGridView1.DataMember = "CATEGORY"
The datagridview shows the data from the table - now I edit the values,
add a few rows and to the following:
Me.Dataset_MIODB.AcceptChanges()
Me.FbDataAdapter_CATEGORY.Update(Me.Dataset_MIODB, "CATEGORY")
Me.FbConnection_MIODB.Close()
Me.FbConnection_MIODB.Open()
Now I reread the content of the database and nothing has changed. And I
really don't know why - do I use the dataset and the adapter as it
should be?
Thanks for your help!
Regards,
Daniel
Oh, here are the commands of the dataadapter:
'
'FbDataAdapter_CATEGORY
'
Me.FbDataAdapter_CATEGORY.DeleteCommand =
Me.FbCommand_CATEGORY_Delete
Me.FbDataAdapter_CATEGORY.InsertCommand =
Me.FbCommand_CATEGORY_Insert
Me.FbDataAdapter_CATEGORY.SelectCommand =
Me.FbCommand_CATEGORY_Select
Me.FbDataAdapter_CATEGORY.UpdateCommand =
Me.FbCommand_CATEGORY_Update
'FbCommand_CATEGORY_Select
'
Me.FbCommand_CATEGORY_Select.CommandText = "SELECT * FROM
CATEGORY;"
Me.FbCommand_CATEGORY_Select.CommandTimeout = 30
Me.FbCommand_CATEGORY_Select.Connection = Me.FbConnection_MIODB
'
'FbCommand_CATEGORY_Delete
'
Me.FbCommand_CATEGORY_Delete.CommandText = "DELETE FROM
CATEGORY WHERE ((ID = @p1))"
Me.FbCommand_CATEGORY_Delete.CommandTimeout = 30
Me.FbCommand_CATEGORY_Delete.Connection = Me.FbConnection_MIODB
Me.FbCommand_CATEGORY_Delete.Parameters.Add(New
FirebirdSql.Data.FirebirdClient.FbParameter("@p1",
FirebirdSql.Data.FirebirdClient.FbDbType.[Integer], 4,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ID", System.Data.DataRowVersion.Original,
CType(resources.GetObject("FbCommand_CATEGORY_Delete.Parameters"), Object)))
'
'FbCommand_CATEGORY_Insert
'
Me.FbCommand_CATEGORY_Insert.CommandText = "INSERT INTO
CATEGORY (ID, NAME) VALUES (@p1, @p2)"
Me.FbCommand_CATEGORY_Insert.CommandTimeout = 30
Me.FbCommand_CATEGORY_Insert.Connection = Me.FbConnection_MIODB
Me.FbCommand_CATEGORY_Insert.Parameters.Add(New
FirebirdSql.Data.FirebirdClient.FbParameter("@p1",
FirebirdSql.Data.FirebirdClient.FbDbType.[Integer], 4,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ID", System.Data.DataRowVersion.Current,
CType(resources.GetObject("FbCommand_CATEGORY_Insert.Parameters"), Object)))
Me.FbCommand_CATEGORY_Insert.Parameters.Add(New
FirebirdSql.Data.FirebirdClient.FbParameter("@p2",
FirebirdSql.Data.FirebirdClient.FbDbType.[Char], 100,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "NAME", System.Data.DataRowVersion.Current,
CType(resources.GetObject("FbCommand_CATEGORY_Insert.Parameters1"),
Object)))
'
'FbCommand_CATEGORY_Update
'
Me.FbCommand_CATEGORY_Update.CommandText = "UPDATE CATEGORY SET
ID = @p1, NAME = @p2 WHERE ((ID = @p3))"
Me.FbCommand_CATEGORY_Update.CommandTimeout = 30
Me.FbCommand_CATEGORY_Update.Connection = Me.FbConnection_MIODB
Me.FbCommand_CATEGORY_Update.Parameters.Add(New
FirebirdSql.Data.FirebirdClient.FbParameter("@p1",
FirebirdSql.Data.FirebirdClient.FbDbType.[Integer], 4,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ID", System.Data.DataRowVersion.Current,
CType(resources.GetObject("FbCommand_CATEGORY_Update.Parameters"), Object)))
Me.FbCommand_CATEGORY_Update.Parameters.Add(New
FirebirdSql.Data.FirebirdClient.FbParameter("@p2",
FirebirdSql.Data.FirebirdClient.FbDbType.[Char], 100,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "NAME", System.Data.DataRowVersion.Current,
CType(resources.GetObject("FbCommand_CATEGORY_Update.Parameters1"),
Object)))
Me.FbCommand_CATEGORY_Update.Parameters.Add(New
FirebirdSql.Data.FirebirdClient.FbParameter("@p3",
FirebirdSql.Data.FirebirdClient.FbDbType.[Integer], 4,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0,
Byte), "ID", System.Data.DataRowVersion.Original,
CType(resources.GetObject("FbCommand_CATEGORY_Update.Parameters2"),
Object)))
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider