Hi there,
I will post my question to this group too bacause the .data group seems
to be rather quiet.
I've been playing with VB.NET and ADO for a week now and find the
different data handling functions very easy and nice. Anyway, I'm afraid
that I haven't understood the data binding things correct.
I'm using MySQL Connector/.NET to access my database from the
application. The queries work find and I'm able to fill the dataset from
data adapter to access the data.
I've binded a few text fields to the dataset in the code (I don't want
to use the Server Explorer).
Me.txtID.DataBindings.Clear()
Me.txtID.DataBindings.Add("Text", dDataset, "table.id")
For debug purposes, I've connected also a DataGrid to the dataset:
Me.DataGrid1.DataSource = dDataset
I fetch a row from the database by SELECT * FROM table WHERE
name="Ville". No problems with getting the correct values to the
textboxes. But now I try to edit the data.
I understood that since a textbox is binded to a dataset, changes made
to the textbox content will update the dataset automatically. OK, it
seems to do that correctly. I edit a textbox, the column content changes
in a datagrid as it should. Now I try to update the database with my
changes:
dAdapter.Update(dDataset, "table")
For some reason, the changes won't reach the database at all. Anyway, no
exception is thrown either.
If I edit the same field value in a datagrid and then call the update of
the data adapter, the modified data will be updated to the databse
without any problems.
Any ideeas?
Thanks for your help!
Ville 2 2292
Ville,
Mostly is the answer to put before the update the sentence
BindingContext(ds.Tables(0)).EndCurrentEdit()
The data is pushed down in the datasource by a rowchange, and with that
command above is that forced.
When you are searching for a good ADONET newsgroup than it the newsgroup
microsoft.public.dotnet.framework.adonet
the one you are looking for
Adonet news://msnews.microsoft.com/microsof...amework.adonet
Web interface: http://communities2.microsoft.com/co...amework.adonet
I hope this helps?
Cor
"Ville Mattila" <vi***@mattila.fi> Hi there,
I will post my question to this group too bacause the .data group seems to be rather quiet.
I've been playing with VB.NET and ADO for a week now and find the different data handling functions very easy and nice. Anyway, I'm afraid that I haven't understood the data binding things correct.
I'm using MySQL Connector/.NET to access my database from the application. The queries work find and I'm able to fill the dataset from data adapter to access the data.
I've binded a few text fields to the dataset in the code (I don't want to use the Server Explorer). Me.txtID.DataBindings.Clear() Me.txtID.DataBindings.Add("Text", dDataset, "table.id")
For debug purposes, I've connected also a DataGrid to the dataset: Me.DataGrid1.DataSource = dDataset
I fetch a row from the database by SELECT * FROM table WHERE name="Ville". No problems with getting the correct values to the textboxes. But now I try to edit the data.
I understood that since a textbox is binded to a dataset, changes made to the textbox content will update the dataset automatically. OK, it seems to do that correctly. I edit a textbox, the column content changes in a datagrid as it should. Now I try to update the database with my changes: dAdapter.Update(dDataset, "table")
For some reason, the changes won't reach the database at all. Anyway, no exception is thrown either.
If I edit the same field value in a datagrid and then call the update of the data adapter, the modified data will be updated to the databse without any problems.
Any ideeas?
Thanks for your help!
Ville
Cor Ligthert wrote: Mostly is the answer to put before the update the sentence
BindingContext(ds.Tables(0)).EndCurrentEdit()
Thank you Cor! I added that row to the code and the data was correctly
updated.
When you are searching for a good ADONET newsgroup than it the newsgroup
microsoft.public.dotnet.framework.adonet the one you are looking for
Thanks for a tip too. I will subscribe there and follow the discussion
for future questions.
Best regards,
Ville This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jason |
last post by:
Let's say I have an html form with 20 or 30 fields in it. The form
submits the fields via POST to a php page which updates a table in a
database with the $_POST vars. Which makes more sense?
...
|
by: Michael Walton |
last post by:
I am trying to write some code that inserts or updates a text field in my
SQL Server 2000 database. The SQL statement is created using a submit from
a form, and the text is coming from a...
|
by: SammyBar |
last post by:
Hi,
I'm trying to bind a custom collection class to a data grid, following the
guidelines from the article
http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx....
|
by: Pam Ammond |
last post by:
I need the code to update the database when Save is clicked and a text field
has changed. This should be very easy since I used Microsoft's wizards for
the OleDBAdapter and OleDBConnection, and...
|
by: Nithin |
last post by:
My code as an txt attachment.
I have 2 drop down list boxes that on selection populate text boxes
from my database table. I am able to display the correct values in
these text boxes.
I have 2...
|
by: enrique |
last post by:
Hi, I apologize for a newbie question, but my books/research have yielded me
no examples and my time is now short.
I simply want to update data from text boxes (fields). I'm not using a
datagrid...
|
by: Frustrated Developer via DotNetMonster.com |
last post by:
I have posted a couple times on here already and found the user community to
be very helpful. I took on a project before I realized how difficult a time
I'm having working with a database....
|
by: Alexander Widera |
last post by:
Hi,
i connect to a ms sql2000server via SqlConnection.
if i make an SqlCommand "INSERT INTO mytable (mytext) VALUES (@mytext)" (or
i make an update),
and i pass the parameter @mytext a simple...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |