Last post Apr 03, 2009 11:41 PM by sree electrons
Mar 06, 2007 02:38 AM|kenrut2|LINK
I frequent this forum and never post a question because I am always able to find my questions already answered by searching the forum. However, this one time I can't seem to find a solution to my problem so if anyone can help, I'd greatly appreciate it.
Here is my code & error message:
Partial Class guestbook
Protected Sub Submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit.Click
Dim connStr As String = ConfigurationManager.ConnectionStrings("KRDB").ConnectionString()
Dim conn As New OleDbConnection(connStr)
Dim cmd As OleDbCommand = New OleDbCommand("INSERT INTO Guestbook ([Name], [EntryTime], [Message]) VALUES (?,?,?)", conn)
cmd.Parameters.Add("@Name", OleDbType.VarChar).Value = Name.Text
cmd.Parameters.Add("@EntryTime", OleDbType.Date).Value = Date.Now()
cmd.Parameters.Add("@Message", OleDbType.VarChar).Value = Comment.InnerText
Catch ex As Exception
Throw New Exception(ex.Message & " " & cmd.CommandText)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Exception: Operation must use an updateable query. INSERT INTO Guestbook ([Name], [EntryTime], [Message]) VALUES (?,?,?)Source Error:
Line 21: conn.Close()
Line 22: Catch ex As Exception
Line 23: Throw New Exception(ex.Message & " " & cmd.CommandText)
Line 24: End Try
Again any insight is greatly appreciated
Mar 06, 2007 03:17 AM|Mikesdotnetting|LINK
It's a permissions issue. You have to apply Modify permissions to the ASPNET account on your Access database. Right click on the file, select the Security tab, then Add to find the ASPNET account.
Mar 06, 2007 11:17 AM|kenrut2|LINK
Thanks for your prompt reply. I realized that it is a permissions problem (Because I upload the DB to a hosting server and all is great). But I still would like to test on my localhost because publishing.
I am running Win XP Pro. With NTFS and I right click on the folder in the c:\inetpub\wwwroot\App_Data folder but I get no "Security" tab or option. What could be the problem?
Mar 06, 2007 11:41 AM|Mikesdotnetting|LINK
Open Windows Explorer, go to Tools -> Folder Options -> View and uncheck Use Simple File Sharing. Then your Security tab should be visible whenever you right click.
Mar 06, 2007 12:12 PM|kenrut2|LINK
Mar 06, 2007 02:17 PM|Mikesdotnetting|LINK
Good News!. You can mark this thread as answered, then. [;)]
Apr 03, 2009 11:41 PM|sree electrons|LINK
Thanks alot Mike, I too got that.Cheers[:D]