hsingh1981
Programmer
Hi Everyone,
I'm having trouble or finding an easy way to update my datagrid back to the sql table 2005.
I can pull the data from sql to datagrid....but when i change the figures in datagrid....i would like it to update the sql table afterwards? Could someone give me an example?
This is how i populate my datagrid.
many thanks
I'm having trouble or finding an easy way to update my datagrid back to the sql table 2005.
I can pull the data from sql to datagrid....but when i change the figures in datagrid....i would like it to update the sql table afterwards? Could someone give me an example?
This is how i populate my datagrid.
Code:
Private Sub GetTempKPI()
Dim sql As String
sql = "SELECT Temp_KPIData.* "
sql = sql + "FROM Temp_KPIData "
sql = sql + "ORDER BY Temp_KPIData.KPI_ID;"
Dim conn As OleDb.OleDbConnection = New OleDb.OleDbConnection(connectionstring)
Dim cmd As New OleDb.OleDbCommand(sql, conn)
Dim adp As New OleDb.OleDbDataAdapter(cmd)
Dim ds As New DataSet()
Dim dt As DataTable = ds.Tables.Add("KPIData")
Dim recordcount As Integer
Try
conn.Open()
Catch ex As Exception
MsgBox("ERROR: Database cannot be opened. See system administrator. MESSAGE: " + ex.Message.ToString, MsgBoxStyle.Critical, "APPLICATION ERROR")
Exit Sub
End Try
Try
adp.Fill(ds, "KPIData")
recordcount = dt.Rows.Count
KPI_DGView.DataSource = dt
Catch ex As Exception
MsgBox("ERROR: Table Temp_KPIData table cannot be queried. See system administrator. MESSAGE: " + ex.Message.ToString, MsgBoxStyle.Critical, "APPLICATION ERROR")
Exit Sub
Finally
conn.Close()
End Try
End Sub
many thanks