?
Solved

Cannot Update a change to DB Table

Posted on 2004-09-15
8
Medium Priority
?
323 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
6 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
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!

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

807 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