473,508 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dataAdapter.Update(data, "TableName") won’t work!

hch

dataAdapter.Update(data, "TableName") won’t work!
I was about to deploy my first website on the Internet 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(DataRow[] dataRows,
DataTableMapping tableMapping)
System.Data.Common.DbDataAdapter.Update(DataSet 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(Event Args e)

System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
Please help – Henry

Nov 22 '05 #1
0 775

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3356
by: Paul Eden | last post by:
Hello all. I'm totally stumped. Please de-stump me! I've read my data in from the database, changed it according to what i want to do and now I want to write it back. But it seems I can only...
2
4198
by: hch | last post by:
dataAdapter.Update(data, "TableName") won’t work! I was about to deploy my first website on the Internet only to discover that the dataAdapter.Update() throws the Server Error in the third...
7
4235
by: | last post by:
I found similiar issues in MS-KB but nothing that helped me; got the Windows and Office updates from the MS website but that hasn't changed the behavior of this problem, and I don't see anything...
6
1768
by: Jon Davis | last post by:
I like the drag-and-drop accessibility of dragging a table to a Web Forms designer and seeing a SqlDataAdapter automatically created for me.. being able to create a DataSet from that is fun and...
2
2199
by: headware | last post by:
I'm relatively new to ASP.NET and ADO.NET, but I have a basic design question regarding the use of web services and APS.NET applications. Right now we have an application that uses web services to...
6
1571
by: Geoff Pennington | last post by:
I have a class method that returns a DataAdapter. I want to access the table(s) contained in the DataAdapter. Of course, accessing the DataSets would be good enough, because I could get the tables...
6
14865
by: Marcel Hug | last post by:
Hi all ! I have a table in my database, which has 3 attributes. IDFailureControl, ControlDate and ControlVersion. In the following function I test, if the date of today allready exists. Then I...
1
1760
by: MJR | last post by:
Could anyone please help me change data in uppercase to data in propercase in MS Access?
0
2661
by: woollymammoth | last post by:
I can't assign a MS SQL Server table record value to a simple VB variable, should be an easy thing. Sample SQL Server table has the data in the record as a char(30) string, the column for that record...
8
2726
by: situ | last post by:
Hello all, i have Database1 and database2, is it possible to make database connection to database2 by running stored procedure on database1. Thanks and Regards Situ
0
7120
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5050
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.