473,326 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Datagrids

Hello. I'm fairly new to VB.Net (2003). I'm using a datagrid to
display data (access db) and when user double clicks on a record,
another form shows up which allows modification/addition of data. The
problem is when user accepts the changes made and gets back to
datagrid. The information displayed is still the old info. How do I
get the new information to display? Here is an example of the code
used to update the data:

objDataSet.Tables("Table").Rows(objCurrencyManager .Position).BeginEdit()
objDataRow =
objDataSet.Tables("Table").Rows(objCurrencyManager .Position)

With objDataRow
.Item("Field1") = Text1.Text
End With
objDataRow.AcceptChanges()
objDataSet.Tables("Table").Rows(objCurrencyManager .Position).AcceptChanges()

Shouldn't the data in the datagrid diplay the information that was
entered in Text1.Text? Or is it that I'm doing something wrong?

Many thanks for any replies!!

Jun 19 '06 #1
4 1432
MFleet,

I would try it by refreshing the datagrid.

http://msdn.microsoft.com/library/de...freshtopic.asp

More worse is the acceptchanges in your code.
It means that all the data in your dataset should be handled as been updated
to the database.

(You are not the first one who interprets this command wrong)
:-)
If means something as Accept changes as done.

I hope this helps,

Cor
<mf********@yahoo.ca> schreef in bericht
news:11**********************@u72g2000cwu.googlegr oups.com...
Hello. I'm fairly new to VB.Net (2003). I'm using a datagrid to
display data (access db) and when user double clicks on a record,
another form shows up which allows modification/addition of data. The
problem is when user accepts the changes made and gets back to
datagrid. The information displayed is still the old info. How do I
get the new information to display? Here is an example of the code
used to update the data:

objDataSet.Tables("Table").Rows(objCurrencyManager .Position).BeginEdit()
objDataRow =
objDataSet.Tables("Table").Rows(objCurrencyManager .Position)

With objDataRow
.Item("Field1") = Text1.Text
End With
objDataRow.AcceptChanges()
objDataSet.Tables("Table").Rows(objCurrencyManager .Position).AcceptChanges()

Shouldn't the data in the datagrid diplay the information that was
entered in Text1.Text? Or is it that I'm doing something wrong?

Many thanks for any replies!!

Jun 20 '06 #2
bob
Cor, I am not clear on what you mean by saying "If means something as
Accept changes as done." Does this mean you should AcceptChanges
(update the database on disk) only when you are done and exit the
DataGrid/program, and not during the editing process? Or, is it
recommended to confirm/write/update a small portion of the data (ie,
the row you just changed) right away? If the latter, how to you do
that?

Thanks.
bo*@datasync.com

Cor Ligthert [MVP] wrote:
MFleet,

I would try it by refreshing the datagrid.

http://msdn.microsoft.com/library/de...freshtopic.asp

More worse is the acceptchanges in your code.
It means that all the data in your dataset should be handled as been updated
to the database.

(You are not the first one who interprets this command wrong)
:-)
If means something as Accept changes as done.

I hope this helps,

Cor
<mf********@yahoo.ca> schreef in bericht
news:11**********************@u72g2000cwu.googlegr oups.com...
Hello. I'm fairly new to VB.Net (2003). I'm using a datagrid to
display data (access db) and when user double clicks on a record,
another form shows up which allows modification/addition of data. The
problem is when user accepts the changes made and gets back to
datagrid. The information displayed is still the old info. How do I
get the new information to display? Here is an example of the code
used to update the data:

objDataSet.Tables("Table").Rows(objCurrencyManager .Position).BeginEdit()
objDataRow =
objDataSet.Tables("Table").Rows(objCurrencyManager .Position)

With objDataRow
.Item("Field1") = Text1.Text
End With
objDataRow.AcceptChanges()
objDataSet.Tables("Table").Rows(objCurrencyManager .Position).AcceptChanges()

Shouldn't the data in the datagrid diplay the information that was
entered in Text1.Text? Or is it that I'm doing something wrong?

Many thanks for any replies!!


Jun 20 '06 #3
Bob,

I cannot answer yes or no on your question, because when you do the database
updates while editing it can be that you use it. But it has forever to do
with update from a database as long as you don't do that, you normally
should not use the acceptchanges.

The acceptchanges can be used by instance in this sentence.

myDataAdapter.Update(myDataTable.getchanges)
Not that this gives any advantage but let assume.

The dataadapter marks the rowstate of rows which are done as not changed.

But the myDataTable.getchanges is a copy of the datatable, so it has to be
done in the origanal as well.

Therefore than the myDataTable.acceptchanges which means that those rows
will not be updated again.

I hope that this makes it a little bit clear because there are not much
samples to give where it has to be used. It is not rare to use it, but there
are very few places (a cascade update by instance can need it as well).

Cor
<bo*@datasync.com> schreef in bericht
news:11**********************@c74g2000cwc.googlegr oups.com...
Cor, I am not clear on what you mean by saying "If means something as
Accept changes as done." Does this mean you should AcceptChanges
(update the database on disk) only when you are done and exit the
DataGrid/program, and not during the editing process? Or, is it
recommended to confirm/write/update a small portion of the data (ie,
the row you just changed) right away? If the latter, how to you do
that?

Thanks.
bo*@datasync.com

Cor Ligthert [MVP] wrote:
MFleet,

I would try it by refreshing the datagrid.

http://msdn.microsoft.com/library/de...freshtopic.asp

More worse is the acceptchanges in your code.
It means that all the data in your dataset should be handled as been
updated
to the database.

(You are not the first one who interprets this command wrong)
:-)
If means something as Accept changes as done.

I hope this helps,

Cor
<mf********@yahoo.ca> schreef in bericht
news:11**********************@u72g2000cwu.googlegr oups.com...
> Hello. I'm fairly new to VB.Net (2003). I'm using a datagrid to
> display data (access db) and when user double clicks on a record,
> another form shows up which allows modification/addition of data. The
> problem is when user accepts the changes made and gets back to
> datagrid. The information displayed is still the old info. How do I
> get the new information to display? Here is an example of the code
> used to update the data:
>
> objDataSet.Tables("Table").Rows(objCurrencyManager .Position).BeginEdit()
> objDataRow =
> objDataSet.Tables("Table").Rows(objCurrencyManager .Position)
>
> With objDataRow
> .Item("Field1") = Text1.Text
> End With
> objDataRow.AcceptChanges()
> objDataSet.Tables("Table").Rows(objCurrencyManager .Position).AcceptChanges()
>
> Shouldn't the data in the datagrid diplay the information that was
> entered in Text1.Text? Or is it that I'm doing something wrong?
>
> Many thanks for any replies!!
>

Jun 20 '06 #4
bob
Hey, now I think I see what you mean. I saw this mentioned in the book
"Programming Visual Basic.net" by Francesco Balena (first edition). He
warned not to ever use the AcceptChanges command, becuase of what you
are saying -- the "dataset" gets updated, but not the disk file. Thanks
for your message.

Cor Ligthert [MVP] wrote:
Bob,

I cannot answer yes or no on your question, because when you do the database
updates while editing it can be that you use it. But it has forever to do
with update from a database as long as you don't do that, you normally
should not use the acceptchanges.

The acceptchanges can be used by instance in this sentence.

myDataAdapter.Update(myDataTable.getchanges)
Not that this gives any advantage but let assume.

The dataadapter marks the rowstate of rows which are done as not changed.

But the myDataTable.getchanges is a copy of the datatable, so it has to be
done in the origanal as well.

Therefore than the myDataTable.acceptchanges which means that those rows
will not be updated again.

I hope that this makes it a little bit clear because there are not much
samples to give where it has to be used. It is not rare to use it, but there
are very few places (a cascade update by instance can need it as well).

Cor
<bo*@datasync.com> schreef in bericht
news:11**********************@c74g2000cwc.googlegr oups.com...
Cor, I am not clear on what you mean by saying "If means something as
Accept changes as done." Does this mean you should AcceptChanges
(update the database on disk) only when you are done and exit the
DataGrid/program, and not during the editing process? Or, is it
recommended to confirm/write/update a small portion of the data (ie,
the row you just changed) right away? If the latter, how to you do
that?

Thanks.
bo*@datasync.com

Cor Ligthert [MVP] wrote:
MFleet,

I would try it by refreshing the datagrid.

http://msdn.microsoft.com/library/de...freshtopic.asp

More worse is the acceptchanges in your code.
It means that all the data in your dataset should be handled as been
updated
to the database.

(You are not the first one who interprets this command wrong)
:-)
If means something as Accept changes as done.

I hope this helps,

Cor
<mf********@yahoo.ca> schreef in bericht
news:11**********************@u72g2000cwu.googlegr oups.com...
> Hello. I'm fairly new to VB.Net (2003). I'm using a datagrid to
> display data (access db) and when user double clicks on a record,
> another form shows up which allows modification/addition of data. The
> problem is when user accepts the changes made and gets back to
> datagrid. The information displayed is still the old info. How do I
> get the new information to display? Here is an example of the code
> used to update the data:
>
> objDataSet.Tables("Table").Rows(objCurrencyManager .Position).BeginEdit()
> objDataRow =
> objDataSet.Tables("Table").Rows(objCurrencyManager .Position)
>
> With objDataRow
> .Item("Field1") = Text1.Text
> End With
> objDataRow.AcceptChanges()
> objDataSet.Tables("Table").Rows(objCurrencyManager .Position).AcceptChanges()
>
> Shouldn't the data in the datagrid diplay the information that was
> entered in Text1.Text? Or is it that I'm doing something wrong?
>
> Many thanks for any replies!!
>


Jun 20 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: | last post by:
In SQL Server Query Analyzer, if I type in, say, 2 select queries, it returns 2 datagrids of results, with a scrollbar on the right to scroll between the 2 (or more) datagrids. I wanted to...
1
by: Simon Harris | last post by:
Hi All, I wish to populate more than one datagrid from the same OleDBCommand. The code I have is: Dim objCmd As New OleDbCommand(strSql, objConn) Then... ...
4
by: ree32 | last post by:
I have a placeholder and depending on a user input(a drop downlist) when the user clicks a button I dynamically create a number of datagrids and fill them with data from a database. But the problem...
0
by: Scott Meddows | last post by:
I'm having trouble scrolling some datagrids so they sync up... I have two identical datagrids on a form, filled with eh same dataset. I want a user to be able to scroll on the datasets and the...
4
by: | last post by:
Hello. In SQL Server Query Analyzer, if I type in, say, 2 select queries, it returns 2 datagrids of results, with a scrollbar on the right to scroll between the 2 (or more) datagrids. I wanted to...
3
by: Mark Wiewel | last post by:
hi all, i am a newbie in ASP.NET and i couldn't find the solution to this one: i have a form with three datagrids on it. i would like to align them vertically with a space between each grid of...
7
by: Ausclad | last post by:
Ok, ill try again..... It seems fairly simple. I have two combo boxes in a datagrid. The datagrid is bound to a a table in a dataset. The two combo boxes are bound to a single data table...
2
by: rn5a | last post by:
In a shopping cart app, a ASPX page retrieves the order details & personal details of a user from a MS-Access database table depending upon the username of the user. The order details of a...
0
by: Jim | last post by:
OK here's my disclaimer: I'm very new to ASP.NET and posting on Google Groups, so please bear with me and feel free to correct either the way I code or the way I post. I have an ASP.NET page...
1
by: =?Utf-8?B?Sm9obiBXYWxrZXI=?= | last post by:
Hi, I am using the code below to export a webpage to Excel. The webpage has three datagrids on it and they are all exported to Excel properly and everything looks very nice, but we would really...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
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...
0
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
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)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.