Update is deleting data. vb 2005
I am currently using SQL Server 2005 Express (Attaching a DB file) / VS 2008 (VB)
I am using the below code to call a sub in another form:
TrainingLog Form Code to open the Add Meal Intake
Code: Private Sub DropDownCommandAddMeal_Click(ByVal sender As Object, ByVal e As Janus.Windows.Ribbon.CommandEventArgs) Handles DropDownCommandAddMeal.Click
AddEditMealIntake.AddMeal()
AddEditMealIntake.ShowDialog()
End Sub
TrainingLog.FillBySelDateUser() Code
Code:
Public Sub FillBySelDateUser()
Me.Cardio_train_logTableAdapter.FillByUser(Me.NWBSQLDataSet.cardio_train_log, SelectedDate, CurrentUser)
Me.Weight_train_logTableAdapter.FillByUser(Me.NWBSQLDataSet.weight_train_log, SelectedDate, CurrentUser)
Me.Daily_meals_tableTableAdapter.FillByUser(Me.NWBSQLDataSet.daily_meals_table, CurrentUser, SelectedDate)
Me.Daily_supplementationTableAdapter.FillByUser(Me.NWBSQLDataSet.daily_supplementation, SelectedDate, CurrentUser)
End Sub
AddEditMealIntake form opens & in that form there is the AddMeal() sub:
Code: Public Sub AddMeal()
Me.Food_tableTableAdapter.Fill(Me.NWBSQLDataSet.food_table)
Me.Meal_categoryTableAdapter.Fill(Me.NWBSQLDataSet.meal_category)
Me.Daily_meals_tableTableAdapter.Fill(Me.NWBSQLDataSet.daily_meals_table)
Me.Daily_meals_tableBindingSource.AddNew()
End Sub
Save Button:
Code:
Private Sub Daily_meals_tableBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Daily_meals_tableBindingNavigatorSaveItem.Click
Me.Validate()
Me.Daily_meals_tableBindingSource.EndEdit()
Me.Daily_meals_tableTableAdapter.Update(Me.NWBSQLDataSet.daily_meals_table)
TrainingLog.FillBySelDateUser()<----This refreshes the datagrid (Janus Grid) on the TrainingLog Form
Me.Close()
End Sub
The issue is that I can add 1 row of data & it works just fine, but when I try to add another row of data, some of the data from the previous row is set to null & updated (I confirmed this in the DB)
source :http://www.vbcity.com
-------------------------------------------------------
Trik Gambar Bergerak
Trik Gambar-dimouse
Trik hapus pwd mysql
Trik insertin to db
Trik jadi root dilinux
Trik jam-distatus-bar
Trik Koneksi-ke database
Trik Koneksi-msql-php
Trik lihat-database-mysql
Trik membahas-fungsi-else
Trik member-area
Rabu, 04 Februari 2009
Langganan:
Postingan (Atom)