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 2 4256
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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?
|
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...
|
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...
|
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...
|
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.
| |
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>
|
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...
|
by: MJR |
last post by:
Could anyone please help me change data in uppercase to data in propercase
in MS Access?
|
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...
|
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,...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without 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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| | |