update

ASP:DetailsView How do I either autofill the insert fields or insert from the edit view

I have a asp web application where I want to be able to add new records without having to retype everything. When I click 'New' it brings up the insert view with empty textboxes or if I goto edit the textboxes are filled but I cannot save it as a new recored. Is there a way to have the selected record autofill the textboxes when I cli...

Operation must use an updatable query. (Error 3073) Microsoft Access

I have written this query: UPDATE tbl_stock1 SET tbl_stock1.weight1 = ( select (b.weight1 - c.weight_in_gram) as temp from tbl_stock1 as b, tbl_sales_item as c where b.item_submodel_id = c.item_submodel_id and b.item_submodel_id = tbl_stock1.item_submodel_id and b.status <> 'D' ...

how can I make a javascript variable update after a download from a web page

I have a page with a few buttons on it. One of them causes a file to download. That process is very server cpu intensive so I don't want them to click it twice. So I've got javascript to block a double click. The problem is I want to unblock it when the file downloads. I have a setinterval doing xmlhttp requests updating the status on th...

Changing a relationship / foreign key in Entity Framework - not being persisted

Hey there, Ive got a WPF app, following the Model View ViewModel pattern, using the Entity Framework to interact with a SQL 2008 database. Problem: My problem is i can't change a foreign key value in the databse using EF. I have two entities: Site and Key. A Site can have many Keys on it. I would like to move a Key from one Site to a...

while loop to update dates in DB only updates first row?

I have no idea why this won't work. function query($sql) { $this->result = @mysql_query($sql, $this->conn); return($this->result != false); } function convert() { $this->db->open(); $sql_update = ""; $this->db->query("SELECT * FROM ACCOUNTS "); $str = ''; while ($row = $this->db->fetchassoc()...

Using IF..ELSE in UPDATE (SQL server 2005 and/or ACCESS 2007)

I need to set a query like below: UPDATE XXXXXX IF column A = 1 then set column B = 'Y' ELSE IF column A = 2 then set column C = 'Y' ELSE IF column A = 3 then set column D = 'Y' and so on and so forth... I am able to do this using multiple queries but was wondering, if I can do it in just 1 statement instead. ...

Select Random record and Update same record in one Query?

I'm working on a small banner-rotation script that loads a random banner from the database. I am tracking impressions in the database and would like to know if I can select a random record and update its impression-value in a single query, or would I need to select a random record, and then update based upon the record pk. Using MySQL. ...

Updating an UNPIVOTted SQL Table

Okay, I've been beating my head against this, and I'm sure I'm just missing something obvious, but... I have a table in a customer's database, that's basically: Item_Set_Key int Item_1 bit Notes_1 nvarchar(80) Item_2 bit Notes_2 nvarchar(80) Item_3 bit Notes_3 nvarchar(80) ... There's 99 items in ea...

How do you upgrade a database schema with InstallShield?

I am using InstallShield to install a SQL Server DB, and the applications that use it. Now I need a way to go back and say, ok, v 27 of the database now needs moved to 28. I have the alter scripts, and I know based on a table which version any given DB is. How can I make InstallShield do this? ...

SQL Server Update Trigger, Get Only modified fields

I am aware of COLUMNS_UPDATED, well I need some quick shortcut (if anyone has made, I am already making one, but if anyone can save my time, I will appriciate it) I need basicaly an XML of only updated column values, I need this for replication purpose. SELECT * FROM inserted gives me each column, but I need only updated ones. somethi...

Updating resource files for iPhone app

I've developed a generic iPhone app, intended for customization via a myapp.cfg file. I've successfully deployed the app to my adhoc testers via iTunes. My question is, how do I update their myapp.cfg file via iTunes. In other words, if they edit the .cfg file on their Windows PC or Macbook, how do they get it into the apps bundle in ...

How to force sequence of updates in DB

I have this table: old_id integer NOT NULL, new_id integer Now I want to update new_id with a sequence in such a way that the order of old_id is preserved. Basically: update table set new_id = sequence.NEXTVAL order by old_id Is something like this possible? If it matters, I'm on Oracle 10g. ...

Fix numbering of many item groups in table

I have a table with these columns create table demo ( ID integer not null, INDEX integer not null, DATA varchar2(10) ) Example data: ID INDEX DATA 1 1 A 1 3 B 2 1 C 2 1 D 2 5 E I want: ID INDEX DATA 1 1 A 1 2 B -- 3 -> 2 2 1 C or D -- 1 -> 1 or 2 2 2 ...

SQL Update Multiple Fields FROM via a SELECT Statement

This works, but i would like to remove the redundancy. Is there a way to merge the update with a single select statement so i don't have to use vars? DECLARE @OrgAddress1 varchar, @OrgAddress2 varchar, @OrgCity varchar, @OrgState varchar, @OrgZip varchar, @DestAddress1 varchar, @DestAddress2 varchar, @DestCity varchar, ...

How to update with Linq-To-SQL?

I need to update values but I am looping all the tables values to do it: public static void Update(IEnumerable<Sample> samples , DataClassesDataContext db) { foreach (var sample in db.Samples) { var matches = samples.Where(a => a.Id == sample.Id); if(matches.Any()) { var match = matches.Fi...

Edit and save multiple records in cakephp

In my cakephp app I have an Option model. In my option/index view I display 2 options with inputs and radio button fields. I want to update both of them, but I get a weird behaviour. The option I alter doesn't get saved and instead a new option is inserted with the new value. Here is my view <h2 class='page-title' id='manage-option...

In SQL, is UPDATE always faster than DELETE+INSERT?

Hello, Say I have a simple table that has the following fields: ID: int, autoincremental (identity), primary key Name: varchar(50), unique, has unique index Tag: int I never use the ID field for lookup, because my application is always based on working with the Name field. I need to change the Tag value from time to time. I'm usin...

can we have :update and :rel(html option) together in a link_to_remote tag

I have link_to_remote tag.I want to update a div.The div name is specified in the form of :rel ( need to do in this way).Can we use link_to_remote so that we can specify :rel and :update. Have any idea? Please help me. ...

Php, update password without login?

I have a new website. And the following is my scenario: I will send an email to 5 people (numbers not important), inside the email, i will include a link for them to click: www.domain.com/[email protected]&key=abc...xyz They key are randomly generated using salt and sha1 in php. Upon click the link in their email, can I directly let t...

Change objects in NSUserDefaults without creating and re-setting copies

I've got dictionary stored in NSUserDefaults and I need to add/remove items in this dictionary. It bothers me that to do this I have to create mutable copy of entire dictionary, change one element and replace entire dictionary with new copy. copy = [[defaults objectForKey:@"foo"] mutableCopy]; [copy setObject:… forKey:@"bar"]; [default...