arcross
asked on
Save record to database using LINQ to SQL
Hi, I'm trying a simple example of populating a gridview from a view in SQL and updating the records displayed back to database.
This is how im binding the data to the grid...
Im having problems with the code above. What I want to do is to update all the records displayed, to the database, with the value from another column from the view.
row. column1 = row.column2
Im not sure how to do this. Do I need to query the view every time to get the ID? and how do I get the field to update from the grid??
Thanks!
This is how im binding the data to the grid...
Data.BindCustomersDataContext db = new BindCustomersDataContext();
var items = (from x in db.vwCustomers select x);
this.gvCustomers.DataSource = items;
this.gvCustomers.DataBind();
select x);
// Field to update here
db.SubmitChanges();
}
}
Im having problems with the code above. What I want to do is to update all the records displayed, to the database, with the value from another column from the view.
row. column1 = row.column2
Im not sure how to do this. Do I need to query the view every time to get the ID? and how do I get the field to update from the grid??
Thanks!
Please post a screenshot of the designer showing the tables in question and if the tables are views or not and the columns to be updated from and to.
ASKER
Hi, at the moment the view is simplest you can get. Just straight from a table. Later on will get a bit more complex. For now, I just wanted to know how to update a series of records in a grid, back to the database.
I want to do 'CustomerStatus = Customer Ack'
CustomerID
CustomerName
CustomerStatus
CustomerAck
I want to do 'CustomerStatus = Customer Ack'
CustomerID
CustomerName
CustomerStatus
CustomerAck
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!!
Not a problem arcross; glad to help.