0
Answer

Updating SQL server database in Visual Express does not update DataClasses1.dbml

Ask a question
Tim

Tim

14y
3.1k
1

Hi,
I am fairly new to programming (and thus C#). Happily, I have solved most of my issues myself... until now.
I am using a database by SQL server. I created an LINQ to SQL classes and dragged 2 tables in the O/R designer.
Furthermore I added my database as a new datasource. Also I am making use of DataGridView to show data from my database.
So, I am making this kind of code:
 

DataClasses1DataContext myContext = new DataClasses1DataContext();
var transactionsUngrouped =
from transactions in myContext.Transactions
where transactions.transactionGrouped == false
select transactions;
foreach (Transaction transaction in transactionsUngrouped)
{
if (transaction.transactionContraAccountName.Contains("something"))
{
// Change group and submut changes
transaction.transactiongroupID = 1;
myContext.SubmitChanges();
// Update 'personal_financeDataSet.Transactions' table.
this.transactionsTableAdapter.Fill(this.personal_productsDataSet.Transactions);
}
}


 
If I update my database structure in the Database Explorer, this is not reflected in the other parts (eg. O/R Designer, DataGriedView). Changing the database data however, will be seen during runtime.
My question: How can I make sure that updating the database is also reflected in the O/R designer and DataGridView, etc.?