Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET 1.1
|
BOOK: Beginning ASP.NET 1.1
This is the forum to discuss the Wrox book Beginning ASP.NET 1.1 with Visual C#.NET 2003 by Chris Ullman, John Kauffman, Chris Hart, Dave Sussman, Daniel Maharry; ISBN: 9780764557088
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 20th, 2005, 09:35 AM
Authorized User
 
Join Date: Jan 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default dataAdapter.Update(data, "TableName") won’t work!

I was about to deploy my first website on the Internet (based on the Beginning ASP.NET 1.1) only to discover that the dataAdapter.Update() throws the Server Error in the third underline. It was working fine before.


ConnectionString in Web.config:
-----------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="ConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;Ole DB Services=-4;Data Source=C:\databases\Resume1.mdb" />

Code in LogOut.aspx.vb
-----------------------------------------
     Dim queryString As String
        Dim data As New DataSet
        Dim dbConnection As OleDbConnection
        Dim dataAdapter As OleDbDataAdapter
        Dim connectionString As String = ConfigurationSettings.AppSettings("ConnectionStrin g")
        queryString = "SELECT * FROM tblApplicLog"
        dbConnection = New OleDbConnection(connectionString)
        dataAdapter = New OleDbDataAdapter(queryString, dbConnection)
        dataAdapter.Fill(data, "tblApplicLog")
        Dim table As DataTable
        table = data.Tables("tblApplicLog")
        Dim selectedRows() As DataRow
        Dim i As Integer = Application("iLastVisitTot")
        selectedRows = table.Select("AplTotVisits = " & i)
        If selectedRows.Length > 0 Then
            selectedRows(0).Item("AplTotVisits") = Application("iVisitTot") + 1
        End If

Dim commandBuilder As OleDbCommandBuilder
        commandBuilder = New OleDbCommandBuilder(dataAdapter)
        dataAdapter.UpdateCommand = commandBuilder.GetUpdateCommand
        dataAdapter.Update(data, "tblApplicLog")
        dbConnection.Close()



Server Error in '/Resume2' Application.
--------------------------------------------------------------------------------

Operation must use an updateable query.
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.Data.OleDb.OleDbException: Operation must use an updateable query.

Source Error:


Line 214: commandBuilder = New OleDbCommandBuilder(dataAdapter)
Line 215: dataAdapter.UpdateCommand = commandBuilder.GetUpdateCommand
Line 216: dataAdapter.Update(data, "tblApplicLog")
Line 217: dbConnection.Close()
Line 218:


Source File: c:\inetpub\wwwroot\Resume2\LogOut.aspx.vb Line: 216

Stack Trace:


[OleDbException (0x80004005): Operation must use an updateable query.]
System.Data.Common.DbDataAdapter.Update(Data Row[] dataRows, DataTableMapping tableMapping)
System.Data.Common.DbDataAdapter.Update(Data Set dataSet, String srcTable)
Resume2.LogOut.lbtClose_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\Resume2\LogOut.aspx.vb:216
System.Web.UI.WebControls.LinkButton.OnClick (EventArgs e)
System.Web.UI.WebControls.LinkButton.System. Web.UI.IPostBackEventHandler.RaisePostBackEvent(St ring eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostB ackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameVa lueCollection postData)
System.Web.UI.Page.ProcessRequestMain()


Please help – Henry
 
Old June 20th, 2005, 09:56 AM
Registered User
 
Join Date: Jun 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Looks like you're experiencing the same problem I was the other day. Imar came up with a really helpful solution to this problem in this thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=31793 (third post down). It seems the 'updateable query' error message occurs as a result of the account being used by IIS to access the database not having permission to use objects in the folder in which the database resides. If you're able to enter the database and run the query 'manually' (i.e., by typing the SQL statement directly into Access's own query tool), then that's almost certainly your problem.
 
Old October 29th, 2008, 02:45 AM
hu_yang
Guest
 
Posts: n/a
Default

try this link , it will help u

http://vb.net-informations.com/dataa...-sqlserver.htm

sre.






Similar Threads
Thread Thread Starter Forum Replies Last Post
update dataadapter karenai Visual Basic 2005 Basics 0 February 9th, 2008 10:46 PM
DataAdapter.Update puzzle wirerider ASP.NET 2.0 Basics 1 August 1st, 2006 06:57 PM
Datagrid.update() and DataAdapter.Update aarunlal ASP.NET 2.0 Professional 2 February 23rd, 2006 11:41 PM
DataAdapter.Update acts strangely oricalchis ADO.NET 0 September 21st, 2005 06:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.