473,729 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

hch

dataAdapter.Upd ate(data, "TableName" ) won’t work!
I was about to deploy my first website on the Internet only to discover that
the dataAdapter.Upd ate() throws the Server Error in the third underline. It
was working fine before.
ConnectionStrin g in Web.config:
-----------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<appSettings>
<add key="Connection String" value="Provider =Microsoft.Jet. OLEDB.4.0;Ole DB
Services=-4;Data Source=C:\datab ases\Resume1.md b" />

Code in LogOut.aspx.vb
-----------------------------------------
Dim queryString As String
Dim data As New DataSet
Dim dbConnection As OleDbConnection
Dim dataAdapter As OleDbDataAdapte r
Dim connectionStrin g As String =
ConfigurationSe ttings.AppSetti ngs("Connection String")
queryString = "SELECT * FROM tblApplicLog"
dbConnection = New OleDbConnection (connectionStri ng)
dataAdapter = New OleDbDataAdapte r(queryString, dbConnection)
dataAdapter.Fil l(data, "tblApplicL og")
Dim table As DataTable
table = data.Tables("tb lApplicLog")
Dim selectedRows() As DataRow
Dim i As Integer = Application("iL astVisitTot")
selectedRows = table.Select("A plTotVisits = " & i)
If selectedRows.Le ngth > 0 Then
selectedRows(0) .Item("AplTotVi sits") = Application("iV isitTot")
+ 1
End If

Dim commandBuilder As OleDbCommandBui lder
commandBuilder = New OleDbCommandBui lder(dataAdapte r)
dataAdapter.Upd ateCommand = commandBuilder. GetUpdateComman d
dataAdapter.Upd ate(data, "tblApplicL og")
dbConnection.Cl ose()

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.Ole Db.OleDbExcepti on: Operation must use an
updateable query.

Source Error:
Line 214: commandBuilder = New OleDbCommandBui lder(dataAdapte r)
Line 215: dataAdapter.Upd ateCommand = commandBuilder. GetUpdateComman d
Line 216: dataAdapter.Upd ate(data, "tblApplicL og")
Line 217: dbConnection.Cl ose()
Line 218:
Source File: c:\inetpub\wwwr oot\Resume2\Log Out.aspx.vb Line: 216

Stack Trace:
[OleDbException (0x80004005): Operation must use an updateable query.]
System.Data.Com mon.DbDataAdapt er.Update(DataR ow[] dataRows,
DataTableMappin g tableMapping)
System.Data.Com mon.DbDataAdapt er.Update(DataS et dataSet, String srcTable)
Resume2.LogOut. lbtClose_Click( Object sender, EventArgs e) in
c:\inetpub\wwwr oot\Resume2\Log Out.aspx.vb:216
System.Web.UI.W ebControls.Link Button.OnClick( EventArgs e)

System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandler.Ra isePostBackEven t(String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()
Please help – Henry

Jul 21 '05 #1
2 4253
hch,

Although this one is not needed, is my question what data is there in
"data"?
(In other words how did you fill or save that during the post and postback?)
dataAdapter.Upd ateCommand = commandBuilder. GetUpdateComman d


This one is not needed the command is already there because of the way you
do it.

Cor
Jul 21 '05 #2
The typical problmes are that 1) You don't have a Primary Key on the table
(not likely based on the current symptoms) 2) You don't have write
permissions (most likely). Verify that you can modify items in the db and
that you have write permissions, in an ASP.NET app, 98% of the time this
symptom is the result of permissions.

--
W.G. Ryan, MVP

www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"hch" <hc*@discussion s.microsoft.com > wrote in message
news:2B******** *************** ***********@mic rosoft.com...

dataAdapter.Upd ate(data, "TableName" ) won't work!
I was about to deploy my first website on the Internet only to discover
that
the dataAdapter.Upd ate() throws the Server Error in the third underline.
It
was working fine before.
ConnectionStrin g in Web.config:
-----------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<appSettings>
<add key="Connection String" value="Provider =Microsoft.Jet. OLEDB.4.0;Ole DB
Services=-4;Data Source=C:\datab ases\Resume1.md b" />

Code in LogOut.aspx.vb
-----------------------------------------
Dim queryString As String
Dim data As New DataSet
Dim dbConnection As OleDbConnection
Dim dataAdapter As OleDbDataAdapte r
Dim connectionStrin g As String =
ConfigurationSe ttings.AppSetti ngs("Connection String")
queryString = "SELECT * FROM tblApplicLog"
dbConnection = New OleDbConnection (connectionStri ng)
dataAdapter = New OleDbDataAdapte r(queryString, dbConnection)
dataAdapter.Fil l(data, "tblApplicL og")
Dim table As DataTable
table = data.Tables("tb lApplicLog")
Dim selectedRows() As DataRow
Dim i As Integer = Application("iL astVisitTot")
selectedRows = table.Select("A plTotVisits = " & i)
If selectedRows.Le ngth > 0 Then
selectedRows(0) .Item("AplTotVi sits") = Application("iV isitTot")
+ 1
End If

Dim commandBuilder As OleDbCommandBui lder
commandBuilder = New OleDbCommandBui lder(dataAdapte r)
dataAdapter.Upd ateCommand = commandBuilder. GetUpdateComman d
dataAdapter.Upd ate(data, "tblApplicL og")
dbConnection.Cl ose()

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.Ole Db.OleDbExcepti on: Operation must use an
updateable query.

Source Error:
Line 214: commandBuilder = New OleDbCommandBui lder(dataAdapte r)
Line 215: dataAdapter.Upd ateCommand =
commandBuilder. GetUpdateComman d
Line 216: dataAdapter.Upd ate(data, "tblApplicL og")
Line 217: dbConnection.Cl ose()
Line 218:
Source File: c:\inetpub\wwwr oot\Resume2\Log Out.aspx.vb Line: 216

Stack Trace:
[OleDbException (0x80004005): Operation must use an updateable query.]
System.Data.Com mon.DbDataAdapt er.Update(DataR ow[] dataRows,
DataTableMappin g tableMapping)
System.Data.Com mon.DbDataAdapt er.Update(DataS et dataSet, String
srcTable)
Resume2.LogOut. lbtClose_Click( Object sender, EventArgs e) in
c:\inetpub\wwwr oot\Resume2\Log Out.aspx.vb:216
System.Web.UI.W ebControls.Link Button.OnClick( EventArgs e)

System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandler.Ra isePostBackEven t(String
eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()
Please help - Henry

Jul 21 '05 #3

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

Similar topics

6
3371
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 use the update statement will only accept explicit fieldnames and value. The fieldnames I can live with, I only have 5 columns in the database, but why can't I pass a $variable to this statement?
7
4246
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 relevant in the newsgroup; help will be gratefully received. Windows 2000 system, I'm logged in with admin rights, using Office 2003. I have two databases on my local drive, in the same subdirectory. In the database HAMCHEESE, I create an...
6
1779
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 exciting, because now with this schema based data outline Visual Studio provides me with a typed class for managing data complete with Intellisense menus exposing my own field names as C# object properties ... cool .. Anyway, I have a problem. I...
2
2212
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 access the database layer. However, the code works in a pretty cumbersome and ungeneric way. Basically every query, update, and insert has its own function. So you see a lot of functions like webService.InsertCustomer(name, age, phone); or...
6
1579
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 from there. I can't find a way to do this. Am I missing something? Much obliged.
4
333
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 underline. It was working fine before. ConnectionString in Web.config: ----------------------------------------- <?xml version="1.0" encoding="utf-8" ?> <configuration>
6
14910
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 would like to write the new ControlDate or Version into the database. First i update the dataset, then i create a Insertcommand and call the update-methode. All datas are in the database, but.... 1.) If I only use the InsertCommand, without...
1
1778
by: MJR | last post by:
Could anyone please help me change data in uppercase to data in propercase in MS Access?
0
2675
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 is named "Try". The VB script function accessing the record value is running on a web hosting server with ASP.Net 2.0 on a web page. Result always is it "can't convert from a Field to type 'String'". Printing out the SQL variable results in...
0
8928
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8766
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9428
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9291
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8160
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6026
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3244
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2171
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.