I'm running into a small issue using MS ACCESS. Has anyone experienced this? After the Web form
Inserts the new Records I can not use a GridView to
Update any records until like several long minutes later. Anyone know why would this happend?
Any thoughts, Ideas, solution, comment, etc would be greatly appreciated and Thanks in Advance!
Jimmy
It usually happens when mdb file is locked by another process and the lock is not released when you complete your session. After executing an sql command, always close the connection to release the lock.
There is another scenario, when you can see data, but you are not able to perform any insert/update or delete statements. It indicates that database is in read-only mode. The cause is the user account that is running your web application does not have write
permission on that mdb file (I am talking about NTFS security).
It usually happens when mdb file is locked by another process and the lock is not released when you complete your session. After executing an sql command, always close the connection to release the lock.
There is another scenario, when you can see data, but you are not able to perform any insert/update or delete statements. It indicates that database is in read-only mode. The cause is the user account that is running your web application does not have write
permission on that mdb file (I am talking about NTFS security).
Thanks Fafar and to answer both question are Yes.
Here's the code...
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= C:\Inetpub\wwwroot\App_Data\agenda.mdb;"
Dim MySQL As String = "INSERT INTO tblAgenda ([Submitted By], [Date], [Request Contact], [To Be Discussed], [Frequency], [Topic], [Details], [Completed]) VALUES ('" & Request.ServerVariables("AUTH_USER").Split("\")(1) & "','" & Now() & "','" & cboReqContacts.SelectedValue.ToString
& "','" & radioTBD.Text.ToString & "','" & txtFrequency.Text.ToString & "','" & txtTopic.Text.ToString & "','" & txtDetails.Text.ToString & "','" & "No" & "')"
Dim MyConn As New Data.OleDb.OleDbConnection(strConn)
Dim cmd As New Data.OleDb.OleDbCommand(MySQL, MyConn)
Jimmyto
Member
95 Points
65 Posts
Unable to edit Database (MS ACCESS) after inserting records
Jan 11, 2007 05:39 PM|LINK
Hi,
I'm running into a small issue using MS ACCESS. Has anyone experienced this? After the Web form Inserts the new Records I can not use a GridView to Update any records until like several long minutes later. Anyone know why would this happend?
Any thoughts, Ideas, solution, comment, etc would be greatly appreciated and Thanks in Advance!
Jimmy
fafar
Participant
917 Points
225 Posts
Re: Unable to edit Database (MS ACCESS) after inserting records
Jan 11, 2007 06:56 PM|LINK
Hi,
Are you closing connection after inserting?
It usually happens when mdb file is locked by another process and the lock is not released when you complete your session. After executing an sql command, always close the connection to release the lock.
There is another scenario, when you can see data, but you are not able to perform any insert/update or delete statements. It indicates that database is in read-only mode. The cause is the user account that is running your web application does not have write permission on that mdb file (I am talking about NTFS security).
Aure Entuluva!
- Day shall come again!
Jimmyto
Member
95 Points
65 Posts
Re: Unable to edit Database (MS ACCESS) after inserting records
Jan 11, 2007 07:20 PM|LINK
Thanks Fafar and to answer both question are Yes.
Here's the code...
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= C:\Inetpub\wwwroot\App_Data\agenda.mdb;"
Dim MySQL As String = "INSERT INTO tblAgenda ([Submitted By], [Date], [Request Contact], [To Be Discussed], [Frequency], [Topic], [Details], [Completed]) VALUES ('" & Request.ServerVariables("AUTH_USER").Split("\")(1) & "','" & Now() & "','" & cboReqContacts.SelectedValue.ToString & "','" & radioTBD.Text.ToString & "','" & txtFrequency.Text.ToString & "','" & txtTopic.Text.ToString & "','" & txtDetails.Text.ToString & "','" & "No" & "')"
Dim MyConn As New Data.OleDb.OleDbConnection(strConn)
Dim cmd As New Data.OleDb.OleDbCommand(MySQL, MyConn)
MyConn.Open()
cmd.ExecuteNonQuery()
MyConn.Close()
Response.Redirect("TopicData.aspx")
End Sub
Leijun Jie -...
Contributor
3076 Points
351 Posts
Re: Unable to edit Database (MS ACCESS) after inserting records
Jan 15, 2007 01:21 AM|LINK
Sincerely,
LeiJun Jie
Microsoft Online Community Support