33 views
Private Sub SaveRecordData()
??????????????????????????????
dS.Tables("Recipe".Rows(RecipeBindingSource.Position).Item("Title") = txtTitle.Text
???????????
dS.Tables("Recipe").Rows(RecipeBindingSource.Position).Item("Notes") = txtNotes.Rtf
???????
adapter.Update(dS, "Recipe")
end sub
i have made the ds (dataset) and adapter global variables and were used when i filled the database
Sub FillDatabase()
ConnectionString = gINI(iniFile, "Settings", "ConnectionString", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\RECIPE.MDB")
Me.RecipeTableAdapter.Fill(Me.recipedataset1.Recipe)
?????? Dim sQuery As String = ""
?????? Try
?????? If RN = 0 Then
?????????? sQuery = "SELECT * FROM [RECIPE] ORDER BY [TITLE], [CATEGORY]"
?????? Else
?????????? sQuery = "SELECT * FROM [RECIPE] WHERE [USERID]=" & RN & " ORDER BY [TITLE], [CATEGORY]"
?????? End If
?????? Dim adapter As New OleDb.OleDbDataAdapter(sQuery, Connection)
?????? dS = New DataSet()
?????? dS.Tables.Add("Recipes")
?????? adapter.Fill(dS, "Recipe")
?????? Me.RecipeBindingSource.DataMember = "Recipe"
?????? Me.RecipeBindingSource.DataSource = dS
?????? Connection.Close()
?????? BindData() e.g. txtTitle.DataBindings.Add(New System.Windows.Forms.Binding("Text", RecipeBindingSource, "Title", True))
????? End Sub
I have tried many code examples here in order to save the data, none of which has worked.
Can anyone please help me with this?