Hi
I am using the below code to write to an access database but when I run it the page just seems to hang. If i cancel the page i cannot access the database properly until windows XP gives me a message some time after saying there has been a delay in the process and it cannot recover the data.
The database is physically located in the folder:
Dim objItem As DataGridItem
Dim strID As String
Dim strErrors As String
Dim strSQL As String
Dim cn As New ADODB.Connection
cn.ConnectionString "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\localhost\lettersdb\letters.mdb;"
strErrors = ""
For Each objItem In myDataGrid.Items
' Ignore invalid items
If objItem.ItemType <> ListItemType.Header And objItem.ItemType <> ListItemType.Footer And objItem.ItemType <> ListItemType.Pager Then
' Retrieve the value of the check box
Dim blnPS As Boolean
blnPS = CType(objItem.Cells(0).FindControl("chkPS"), CheckBox).Checked
strID = objItem.Cells(1).Text
If blnPS = True Then
strSQL = "UPDATE tblC SET Response = 'PS' WHERE C_ID = '" & Trim(strID) & "'"
cn.Open()
cn.Execute(strSQL)
cn.Close()
End If
End If
Next
cn = Nothing
Thanks B
I am using the below code to write to an access database but when I run it the page just seems to hang. If i cancel the page i cannot access the database properly until windows XP gives me a message some time after saying there has been a delay in the process and it cannot recover the data.
The database is physically located in the folder:
Dim objItem As DataGridItem
Dim strID As String
Dim strErrors As String
Dim strSQL As String
Dim cn As New ADODB.Connection
cn.ConnectionString "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\localhost\lettersdb\letters.mdb;"
strErrors = ""
For Each objItem In myDataGrid.Items
' Ignore invalid items
If objItem.ItemType <> ListItemType.Header And objItem.ItemType <> ListItemType.Footer And objItem.ItemType <> ListItemType.Pager Then
' Retrieve the value of the check box
Dim blnPS As Boolean
blnPS = CType(objItem.Cells(0).FindControl("chkPS"), CheckBox).Checked
strID = objItem.Cells(1).Text
If blnPS = True Then
strSQL = "UPDATE tblC SET Response = 'PS' WHERE C_ID = '" & Trim(strID) & "'"
cn.Open()
cn.Execute(strSQL)
cn.Close()
End If
End If
Next
cn = Nothing
Thanks B