|
-
Jul 18th, 2006, 12:38 AM
#1
Thread Starter
Lively Member
[02/03] Access DataBase problem.....
Hi there
I have a data table named "test" on the Access Database named "My_First.mdb".
I did the followings.
(1) Public m_connection As New OleDb.OleDbConnection
public m_dataAdapter_test As New OleDb.OleDbDataAdapter
Public m_commandBuilder_test As OleDb.OleDbCommandBuilder
Public m_dt_test As New DataTable
(2) Opened the connnection "m_connection" using the correct connection
string
(3) m_dataAdapter_test = New OleDb.OleDbDataAdapter("Select * from test",
m_connection)
m_commandBuilder_test = New OleDb.OleDbCommandBuilder(m_dataAdapter_test)
m_dataAdapter_test.Fill(m_dt_test)
(4) Everthig was going ok, i could edit the entries on the database except one thing.
that's.......
Once i add a new row, the data adapter ("m_dataAdapter") is showing correctly that the new row's been added...
But when it's going to update it usting the following code.
"m_dataAdapter_test.Update(.m_dt_test)" it shows the following error.
An unhandled exception of type 'System.Data.DBConcurrencyException'
occurred in system.data.dll
Additional information: Concurrency violation: the UpdateCommand affected
0 records.
please help me to correct this error.
-
Jul 18th, 2006, 01:32 AM
#2
Thread Starter
Lively Member
Re: [02/03] Access DataBase problem.....
could anyone hlep me please............
-
Jul 18th, 2006, 02:03 AM
#3
Addicted Member
Re: [02/03] Access DataBase problem.....
Hi sriya,
i beleive that you need to create a DataRow to add a new ROW as shown below
VB Code:
Dim dtcmp As DataRow = m_dt_test.NewRow
dtcmp("CompanyName") = txtCompany.Text
'etc
'etc
m_dt_test.Rows.Add(dtcmp)
m_DataAdapter.Update(m_dt_test)
second this line "in ur code" has an error, there is . before m_dt_test
"m_dataAdapter_test.Update(.m_dt_test)" it shows the following error.
hope this helps...
Regards,
=======================================
If I helped you, Kindly Rate my post. Thanks
-----------
PHENOM 
-
Jul 18th, 2006, 03:08 AM
#4
Thread Starter
Lively Member
Re: [02/03] Access DataBase problem.....
thanx phenom,,,
but the data row could be added without any problem... I did it exactly in ur way & when checking the dataAdapter shows that it has the new row...
the matter comes when the dataAdapter is updated...
pls hlep me.
-
Jul 18th, 2006, 05:51 AM
#5
Addicted Member
Re: [02/03] Access DataBase problem.....
Hi Sriya,
Better to post your full code "when u add a new Row"to test it... cuz the code i posted should work 100%...
Regards,
Last edited by phenom; Jul 18th, 2006 at 06:01 AM.
=======================================
If I helped you, Kindly Rate my post. Thanks
-----------
PHENOM 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|