Solved

Cannot Update a change to DB Table

Posted on 2004-09-15
8
316 Views
Last Modified: 2010-05-18
Hi,

Thanks for clicking

I have GridEx (like a DataGrid) that's ource Table is Tbl_Alarms in an Access 2000 DB.

It bound to it through a DataAdapter and DataSet. This DataAdapter is a join between two tables Tbl_Alarms and Tbl_LocalTempAlarmsListBox.

I am simply looking to update two columns which are the only columns that can be changed (columns named ForeColor and BackColor)

Whenever I change the colour of the GridEx Row, I change the value of the columns ForeColor and BackColor to the rgb number associated.

Then after this change I send the info back to the DB table so that the changes are recorded. I do this by this code

dsAlarms.AcceptChanges()
GridEXAlarms.UpdateData()
daAlarms.Update(dsAlarms)

For some reason at AcceptChanges the value recorded in ForeColor and BackColor (changed when the colors are changed) reset to DBNull.

Anybody any idea why?? Spent 2-3 hrs on this now. Your help would be most appreciated.

Best Rgds

Rob
0
Comment
Question by:RobKearney
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 27

Expert Comment

by:planocz
ID: 12066450
try this...
 
daAlarms.Update(DS.Tables("MYTableName"))
0
 
LVL 4

Expert Comment

by:gdexter
ID: 12066624
Do not Acceptchanges before an update

Rearange to

daAlarms.Update(dsAlarms)
dsAlarms.AcceptChanges()
GridEXAlarms.UpdateData()
0
 

Author Comment

by:RobKearney
ID: 12067671
guys,

Gave your two ideas a try.

planocz - Gave it a try, still causes the same crash at Update command.

gdexter - recognise that AcceptChanges appears after Update. Thank you!. Problem is, like I mentioned to planocz, it's the Update command that causes the problem. It doesn't even show an error message when it crashes.

I've done this on several other forms and works fine, it's only this form that causes problem and I think it's the fact that it's binding to TWO tables in the DataAdapter thats the problem.

Think it's a limitation of updating to TWO tables throught the dataAdapter. I had to create my own Update SQL in the DataAdapter that looked like this.

UPDATE Tbl_Alarms SET ForeColor = ?, BackColor = ? WHERE (AlarmRefNo = ?)

How about simply running an UPDATE sql statement to do the update (in code) to the table. Are there any issues in data integrity??

Thanks guys!!
Rob
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 27

Expert Comment

by:planocz
ID: 12067771
0
 

Author Comment

by:RobKearney
ID: 12301094
Didn't really get an breaks from the guys posts, even tough I was most appreciative of their support. Thank you!

I ended up solving the problem myself by running a INSERT INTO sql statement in the code that wrote back to the Tables in question.

Would I be able to get a refund, since it's a reasonable 250 pts allocated that I could save for a future post.


0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12327307
PAQed, with points refunded (250)

Computer101
E-E Admin
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question