[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Cannot Update a change to DB Table

Posted on 2004-09-15
8
Medium Priority
?
321 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
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.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

656 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