Asp.Net News
Free Tech Magazines
Asp.Net Web Hosting
Suggest Us
Link to Us
Feeds Subscription
Questions & Answers
Tips & Tricks
 Trouble with database synchronization
Posted by Babak Asgharian on  11/1/2008 5:57:00 PM Category: Asp.Net 2.0
Add to my favorites
Email to friend
I am using c# language, visual studio 2008. I am making a fitness app with a Client table, WorkoutJournal table, and FoodJournal table. I am using a gridview to display the food and workout journals.

Lately I have run into a problem where:
I add a data entry to a Journal
View Journal <--- here it wont display new item so....
I manually open the database in the server explorer.
Now I refresh to view journal again and the new entry now displays.

Any ideas why this doesnt automatically show while I'm running the program?
(also pls note: my gridview edit, update, delete, cancel all works perfect. Also I can add a client and instantly view it on the client gridview perfectly as well. I am thinking there is problem with the child data tables connection?)

protected void Button1_Click(object sender, EventArgs e)
FoodJournal journal = new FoodJournal();
journal.Calories = this.uxTextBoxCalories.Text;
journal.Food = this.uxTextBoxFood.Text;
journal.Id_Client = this.GetMemberID();
journal.MealTime = this.Calendar1.SelectedDate;
journal.Carbs = this.uxTextBoxCarbohydrates.Text;
journal.Protein = this.uxTextBoxProtein.Text;
journal.Fat = this.uxTextBoxFat.Text;
catch(Exception ex)

this.uxTextBoxFood.Text = "SAVE FAILED!!!!!!!!!";
//set textboxes to blank values when done updating
Here is from my Services.cs
public static void SaveFoodJournal(FoodJournal journal)



Post Your Reply Post New Question

 Viewer's Reply
Call your Data Bind method
Answered By Moderator1 on 11/4/2008 7:59:15 AM
Everytime you do database manipulation, then you have to call the Data Binding methods for the GridView to show the changes affected.

If you are using SQLDataSource, then use the below syntax after you call save methods.

Oops. I had figured this out.
Answered By Babak Asgharian on 11/4/2008 8:43:49 AM
I had to change my data source to LINQ to fix the problem and all went well. Why I had to do this will always be unknown..
Post Your Reply If you still have problem, post it again under this reply for better response.

Sponsored by
Oracle Magazine
Introduction to Software Development
Many .NET teams are underperforming, is yours?