I have a form I'm playing around with that has some text boxes on it. I am
using SQL 2005 for my database.
I have a single table which I have created an object entity for. Customer
On the form I set the DataBindings Text value to "customerBindin gSource -
CompanyName" on one of the textboxes.
The customerBinding Source was generated by the IDE and is pointing to the
Customer entity I created earlier. The CompanyName is a field within the
entity and underlying table.
During runtime I am using the follow code:
//----------------------------------------------------------------------------------
// This line is where my problem is.
this.CDC = new CustSiteDataCon text(ConnString );
// Retreive customer record
var queryCust = from cust in CDC.Customers
where (cust.CustomerI D == 100) && (cust.CompanyID == 5)
select cust;
this.customerBi ndingSource.Dat aSource = queryCust;
//----------------------------------------------------------------------------------
This works great, it reads the data in, I can make modifications and when I
click my button to save I execute:
this.CDC.Submit Changes();
If the user wishes to abandon the changes, the idea is they can click a
button to do so. This code appears to work however I have to recreate a
new instance of the CustSiteDataCon text for this to work.
In prior attempts I was looking at the refresh method, but I could not
figure out how to write it.
// CDC.Refresh(Sys tem.Data.Linq.R efreshMode.Over writeCurrentVal ues);
Is the method I am using above the best/only way to implement "abandon"
changes ?
Thanks,
Dan
using SQL 2005 for my database.
I have a single table which I have created an object entity for. Customer
On the form I set the DataBindings Text value to "customerBindin gSource -
CompanyName" on one of the textboxes.
The customerBinding Source was generated by the IDE and is pointing to the
Customer entity I created earlier. The CompanyName is a field within the
entity and underlying table.
During runtime I am using the follow code:
//----------------------------------------------------------------------------------
// This line is where my problem is.
this.CDC = new CustSiteDataCon text(ConnString );
// Retreive customer record
var queryCust = from cust in CDC.Customers
where (cust.CustomerI D == 100) && (cust.CompanyID == 5)
select cust;
this.customerBi ndingSource.Dat aSource = queryCust;
//----------------------------------------------------------------------------------
This works great, it reads the data in, I can make modifications and when I
click my button to save I execute:
this.CDC.Submit Changes();
If the user wishes to abandon the changes, the idea is they can click a
button to do so. This code appears to work however I have to recreate a
new instance of the CustSiteDataCon text for this to work.
In prior attempts I was looking at the refresh method, but I could not
figure out how to write it.
// CDC.Refresh(Sys tem.Data.Linq.R efreshMode.Over writeCurrentVal ues);
Is the method I am using above the best/only way to implement "abandon"
changes ?
Thanks,
Dan
Comment