473,387 Members | 1,282 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,387 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 1435
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.