Hi,
I fill my datagridview using the code shown but I don't know how to approach saving any changes or new rows that I make to the datagrid. I think I need to get hold of the changes somehow and then add these to a data adaptor and then use dataadaptor.update? Any help would be gratefully received. Here is the code:
Thank you
Note:
I am using VB 2008 Express Edition and .NET framework 3.5 SP1, and SQL server compact 3.5.
I fill my datagridview using the code shown but I don't know how to approach saving any changes or new rows that I make to the datagrid. I think I need to get hold of the changes somehow and then add these to a data adaptor and then use dataadaptor.update? Any help would be gratefully received. Here is the code:
VB.NET:
Private Sub frmLabMat_Load(.....)etc...
conn.Open()
Dim sqlString As String = "SELECT * FROM Timesheets WHERE JobID ='" & cbxJob.SelectedValue & "' AND (WorkDate BETWEEN @StartDate AND @EndDate)"
dgvLabour.DataSource = fillDataTable(sqlString, mcSelectDate.SelectionStart)
End sub
Function fillDataTable(ByVal sqlString As String, ByVal StartDate As DateTime) As DataTable
cmd = New SqlCeCommand(sqlString, conn)
Dim EndDate As DateTime
EndDate = StartDate.AddDays(6)
cmd.Parameters.Add(New SqlCeParameter("@StartDate", StartDate))
cmd.Parameters.Add(New SqlCeParameter("@EndDate", EndDate))
dr = cmd.ExecuteReader()
dt = New DataTable()
dt.Load(dr)
Return dt
End Function
Thank you
Note:
I am using VB 2008 Express Edition and .NET framework 3.5 SP1, and SQL server compact 3.5.