Unspecified Error When Inserting/updating Record Using SqlCeResultSet On Sql Compact
Nov 14, 2007
Hi,
Inside a single transaction I'm inserting/updating multiple records into multiple tables, in this order:
table 1 record 1
table 2 record 1
table 3 record 1
table 1 record 2
table 2 record 1
table 1 record 3
table 2 record 3
table 3 record 3
Now I'm getting an unspecified error on a certain table:
Indicates a data modification, such as an insert, an update, or a deletion. Ensures that multiple updates cannot be made to the same resource at the same time. (I assume that multiple updates within the SAME transaction can be made, only multiple updates from different transaction cannot be made, right?)
I cannot find any reference to this error message and don't know what the numbers mean. Maybe it relates to data that can be found in the sys.lock_information table like explained here, http://technet.microsoft.com/en-us/library/ms172932.aspx, but I'm not sure.
Furthermore, the sys.lock_information table is empty. I haven't been able to reproduce the problem myself. I only received an error log and the database to investigate it.
So, does anybody have an idea what this error message means and what I can do to troubleshoot this?
I've noticed that after the first record from a ResultSet is deleted, HasRows property throws an exception like "The current row was deleted." Method ReadFirst() throws similar exception as well.
More details:
1. Create a ResultSet: ExecuteResultSet(ResultSetOptions.Updatable | ResultSetOptions.Scrollable | ResultSetOptions.Sensitive)
2. Let's say, there is no records in the resultset. Insert two new ones. Then call: ReadAbsolute(0); Delete(); HasRows; and the exception is thrown.
3. Then you can call ReadFirst() or Read with the same result.
4. Now call ReadAbsolute(0). It returns true. Call HasRows, ReadFirst() or Read() and you will get the exception each time.
I tried to explain this with the fact that Delete() doesn't change the current position of the ResultSet. But I don't see why that would mess the HasRows property or why after ReadAbsolute(0) retuns true, HasRows or ReadFirst() doesn't work.
I've noticed that after the first record from a ResultSet is deleted, HasRows property throws an exception like "The current row was deleted." Method ReadFirst() throws similar exception as well.
More details:
1. Create a ResultSet: ExecuteResultSet(ResultSetOptions.Updatable | ResultSetOptions.Scrollable | ResultSetOptions.Sensitive)
2. Let's say, there is no records in the resultset. Insert two new ones. Then call: ReadAbsolute(0); Delete(); HasRows; and the exception is thrown.
3. Then you can call ReadFirst() or Read with the same result.
4. Now call ReadAbsolute(0). It returns true. Call HasRows, ReadFirst() or Read() and you will get the exception each time.
I tried to explain this with the fact that Delete() doesn't change the current position of the ResultSet. But I don't see why that would mess the HasRows property or why after ReadAbsolute(0) retuns true, HasRows or ReadFirst() doesn't work.
i currently have more tha 3 million of records in my table in sql 7. i am getting timeout error in my web application when i try to insert a record in that table
what could be rhe reason for this? how to avoid this type of problem?
I am very new to SQL Server 2005. I have created a package to load data from a flat delimited file to a database table. The initial load has worked. However, in the future, I will have flat files used to update the table. Some of the records will need to be inserted and some will need to update existing rows. I am trying to do this from SSIS. However, I am very lost as to how to do this.
Hi, Can anybody help me with this, I've got a simple program to add a new record to a table (2 items ID - Integer and Program - String) that matches all examples I can find, but when I run it I get the error : Must declare the scalar variable "@BookMarkArrayA". when it reaches the .insert command, I've tried using a local variable temp in place of the array element and .ToString , but still get the same error This is the code : Public Sub NewCustomer() Dim temp As String = " " Dim ID As Integer = 1 'Restore the array from the view state BookMarkArrayA = Me.ViewState("BookMarkArrayA")
temp = BookMarkArrayA(6) Dim Customer As SqlDataSource = New SqlDataSource()
I have a problem with inserting records into table when an indexed viewis based on it.Table has text field (without it there is no problem, but I need it).Here is a sample code:USE testGOCREATE TABLE dbo.aTable ([id] INT NOT NULL, [text] TEXT NOT NULL)GOCREATE VIEW dbo.aViewWITH SCHEMABINDING ASSELECT [id], CAST([text] AS VARCHAR(8000)) [text]FROM dbo.aTableGOCREATE TRIGGER dbo.aTrigger ON dbo.aView INSTEAD OF INSERTASBEGININSERT INTO aTableSELECT [id], [text]FROM insertedENDGODo the insert into aTable (also through aView).INSERT INTO dbo.aTable VALUES (1, 'a')INSERT INTO dbo.aView VALUES (2, 'b')Still do not have any problem. But when I need index on viewCREATE UNIQUE CLUSTERED INDEX [id] ON dbo.aView ([id])GOI get following error while inserting record into aTable:-- Server: Msg 8626, Level 16, State 1, Procedure aTrigger, Line 4-- Only text pointers are allowed in work tables, never text, ntext, orimage columns. The query processor produced a query plan that requireda text, ntext, or image column in a work table.Does anyone know what causes the error?
We hit this error about 2 weeks ago on SQL Server 2000 and it seems to be getting worse. We have a table that stores phone numbers (wtns). We have a number of pages that query this table. I can sit and click a link that queries this table over and over and finally after about 40-50 clicks, it will fail and repeatedly fail for about a minute with: Microsoft OLE DB Provider for ODBC Drivers error '80004005'Unspecified error If our system is busy, I can get to the error much quicker. The strange thing is this table and these pages have not been modified, some of them haven't been touched in years so these queries worked just fine for that long until Dec 4th when the problems started (nothing significant happened that day or prior to that either). I have the SQL Profiler running and what I see is the SELECT stmt completes just fine. The stmt looks as expected and I can even run it manually and it works fine. Then I see a series of audit login audit logout pairs in the profiler but nothing else, where I would expect to see more Queries from that page on other tables. If I go to any of the 5 pages or so that has a similar query to this table, I can get the same error. No other table in our DB causes this problem. There is no problem cleaning up the connection/resultset either. Any ideas where to look? We've done alot recently to try and fix it: Reinstalled MDAC, reinstalled SQL Server SP, increased memory, shrunk the trans log, reindexed the table, changed the cursor around (made it readonly as it initally wasn't), modified permissions. Nothing seems to work. This is on SQL Server 2000MDAC 2.81.1128.0Windows 2000 SP4IIS Our Connection string looks like the following: Session("Conn") = "DRIVER={SQL Server};SERVER=DS20021218001;DATABASE=ODB;UID=webUser;PWD=*** Any ideas on where to go next? What to try?
I have a DTS to transfer logins from one server to a another server. I have put the syslogins.dat file in the share directory. But this DTS is giving 'Unspecified Error'. Any help would be appreciated.
We're running a Sage CRM install with a SQL Server 2000 database at the back end. We're using the Sage web services API for updating data and a JDBC connection to retrieve data as it's so much quicker.
If I retrieve a record using the JDBC connection and then try and update the same record through the web services, the query times out as if the record is locked for updates. Has anyone experienced anything similar or know what I'm doing wrong? If I just use DriverManager.getConnection() to establish the connection instead of the datasource, and then continue with the same code I don't get these record locking problems. Please find more details below.
Thanks, Sarah
The JDBC provider for the datasource is a WebSphere embedded ConnectJDBC for SQL Server DataSource, using an implementation type of 'connection pool datasource'. We are using a container managed J2C authentication alias for logging on.
This is running on a Websphere Application Server v6.1.
We have a system that has been running for years and some of the .asp pages haven't been touched in years, but about 10 days ago the same SQL stmts that have always been there have been returning
Microsoft OLE DB Provider for ODBC Drivers error '80004005' Unspecified error
This is on SQL Server 2000 MDAC 2.81.1128.0 Windows 2000 SP4 IIS
The problem is this occurs at random. The statement will execute 5x, then fail once, then run 2 more times and fail again. There isn't a problem with the SQL itself as the same Select stmt will fail or pass randomly. I can also take and execute the stmt manually and it will also pass. There are about 5 places it occurs in our pages. Here is on particular example. Note that DataRS("acc_num") is a valid value and will return just fine if I manually execute it and will pass probably 75% of the time as it is, but 25% of the time will fail with above error.
CMD = "SELECT TOP 1 id, acc_num, businessType, mdCountry, cust_lec, First_Name, Last_Name FROM accounts WHERE (Acc_Num = '" & DataRS("acc_num") & "')"
AccRS.Open CMD, DBConn, adOpenForwardOnly
Not sure at all what is causing this. I've haven't been able to find anything conclusive in the SQL Profiler either.
Any ideas?
Is this the correct version of MDAC? I tried to get the latest, but it was an earlier version .1117.
I'm writing a PDA app which has an SQL CE database on the storage card. Under certain circumstances, I get an Error Code 80004005 ; "Unspecified Error" exception (henceforth referred to as "The Error".
I can write to a certain table (the only one which has a problem) many times on the first run of the app since the database was created. However if I exit and reload the app, the error starts hapenning. It does not go away until I delete the database and re-create it.
The database has a password (I've tried with and without this to no avail) and the temp file is being stored on the Storage Card (the PDA itself doesn't have enough memory).
I have been extensively searching the net for existing solutions. I found this one from microsoft, (http://support.microsoft.com/?kbid=919150) which suggests the PDA is coming out of suspend mode and trying to access the Storage Card. This sounds reasonable and similair to my case. I would like to change my code so it is not coming out of suspend mode (instead of trying to find that hotfix) but I don't know what suspend mode is. The code is being called from a button's handler. This sounds like it is coming out of suspend mode, doesn't it?
Has anyone else seen this? It has brought my project to a grinding halt and I can not see anything wrong with my code (it's doing the same insert command I've done a million times before on other tables).
Is that possible to restrict inserting the record if record already exist in the table.
Scenario: query should be
We are inserting a bulk information of data, it should not insert the row if it already exist in the table. excluding that it should insert the other rows.
I have lost the ability to query any table in my database using the Query Designer/table viewer in Enterprise Manager. I get the following error: Query Designer has encountered an error. Unspecified error.
I can still query the table from SQL Query Analyzer and the client front end. Has anyone seen this problem before?
Using the lookup on a table, working with Haselden book, I plug into table on the reference table tab and then press columns tab and get "Unspecified Error" Any thoughts?
I have processed the data successfully for the cube after desiging storage as MOLAP with 50% performance gain. When I tried browse the data I am getting the followign error.
Unable to Browse the cube 'cubename', Unspecified error.
Connecting to the database to change a record works fine in xp/xphome but trying the same thing in 2000 workstaton causes the error above. Here is the script....tried adding a password to sa, but same results Any help would surely be appreciated '========================================================================== ' NAME: templateselector.vbs ' DATE : 6/22/2006 ' ' COMMENT: Runs from an External Process. Assigns a template to an client ' and starts a PXE reset '==========================================================================
Set conn = createObject("ADODB.Connection") conn.Open (sConnection)
Set oWshNet = CreateObject("WScript.Network") sCompName = oWshNet.ComputerName
SQLTEXT="select * from WICON_MACHINES where name = '"&sCompName&"'" Set nodeRS = conn.execute(SQLTEXT)
sMID=nodeRS("MachineID")
SQLTEXT="update WIPXECR_CLIENTS set templateid='"&sTemplateID&"', RESETCMD='1', RESETSTATUS='1' where machineid='"&sMID&"'" Set nodeRS = conn.execute(SQLTEXT)
Hello, we've developed an application that runs on AXIM X51, if it is an important to know.
The data layer handles the connection using the singleton pattern, a bit of code of this is:
(....) Private Shared ceConnection As SqlCeConnection (....)
Public Shared Function GetConnection() As SqlCeConnection Try If (ceConnection Is Nothing) Then ceConnection = New SqlCeConnection(Me.connectionString) End If
If (ceConnection.State = ConnectionState.Closed) Then ceConnection.Open() End If
Return ceConnection Catch ex As Exception Throw ex End Try End Function
(....)
So far nothing strange. We started experiencing problems when the end-users get an "Unspecified error" which later debugging it we got the href value inside the exception object is -2147467259 and nothing else. And if that wasn't enough I couldn't replicate the error in my pocket.
The only way I got the same error was removing the SD Card where the db is located at the same time the application was still open.
Does anybody experienced the same problem??? I researched about this kind of errors "when the device is just restored from the suspend mode" but with out luck.
Please, I really appreciate any help with this issue. Any comment will be more than welcome.
i m getting the following error while exporting an excel file in SSIS
SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft JET Database Engine" Hresult: 0x80004005 Description: "Unspecified error".
Greetings: We have a database with approximately 15-20 tables. Last week, using Enterprise Manager, we were able to open any of these tables and return all rows. Yesterday, when we tried to do this, we got the following message:
An Unexpected Error happened during this operation. [Query] - Query Designer encountered a Query Error: Unspecified Error
Can anyone tell me what might be causing this and how to fix it? Barring that, can anyone suggest some general steps I might take to possibly eliminate this problem without knowing the cause? Last, can you point me to a good resource for investigating problems of this kind, such as a knowledge base (other than Microsoft's TechNet)?
I need you help badly. Iam a student and iam working on "Creating a Mobile Application with SQL Server Compact Edition" http://msdn2.microsoft.com/en-us/library/ms171908.aspx . This tutorial works fine until
Create the publication snapshot
In SQL Server Management Studio, in Object Explorer, expand the (local) computer node.
Expand the Local Publications folder, select the publication name, right-click SQLMobile, and then click View Snapshot Agent Status.
In the View Snapshot Agent Status dialog box, click Start.
Make sure that the snapshot job has succeeded before you continue.
When I try to create a snapshot iam getting the following error "An unspecified error had occurred in the native SQL Server connection component." . I have no clue what to do next please help me out.
When using a subscription to send mail, I find that the report can be sent in any format apart from Excel, which gives me the error: "Failure sending mail: Unspecified error". As you can imagine, this doesn't give me much to go on!
I want to use Excel format as it retains the drilldown functionality (hiding / unhiding rows). The ExecutionLog has the status as rsSuccess, but Subscription tab for the report shows the error.
How Can I get Identitiy field from database while inserting new row in sql server 2005 compact edition.
Ex:
I am inserting row in a table through SqlQuery ("insert into ....") in which one of the field is of type Identity which generates number automatically. I want that number to pick up that number and used it in child table....
I have ran into the same problem ... Importing from Access into SQL 2005 using SSIS and get the error:
[Connection manager "SourceConnectionOLEDB"] Error: An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft JET Database Engine" Hresult: 0x80004005 Description: "Unspecified error".
i am using visual web developer 2005 and SQL Express 2005 with VB as the code behindi have a button and in the button click event i have written codes to INSERT to a database table - it has one primary keyso when i click the button, if there is already a row with primary key fields value as 10 and if i try to INSERT with the same value in the primary key field there will occur primary key constraintso , if i try to INSERT with the already existing primary key fields value, instead of INSERTing it should be UPDATEd without generating any errorplease help me
Does anybody have a sample SQL script that will select table A and compare it to table B. If a row exists in both table A and table B, it will update the columns in table B with the columns in table A. If the row does not exist in table B, it will insert a row in table B using the row in table A. Is this possible?
I have an asp.net project that displays a timesheet based on a fortnightly system.
It has a Y and X axis, i.e. Sun-Mon, Sun-Mon across the top and Categories of hour types accross the Y axis, i.e. Holidays, Overtime, Maintenance.
I was using a datagrid to gather the rows, but I need to have the whole grid in edit mode which is something that requires more coding. So I have swapped to a datalist.
It will take me 240 fields to store all the data in their corresponding fields. So I basically need to know if there is an easier way to store two dimensional array type data into an SQL table using a minimum of fields.
SQLNewbie writes "I have a table 'ImportedListings' that is populated with data external to the database. This table is only used to hold the data until I can move it to the permanent table 'Listings' at which point 'ImportedListings' gets truncated to nothing. Both tables contain almost identical data and structure. There is a listing ID column available for joins.
Basically I need to compare each row in ImportedListing and if it already exists in Listing, UPDATE Listing with the new info. If the row in ImportedListing doesn't exist in Listing, I need to INSERT it.
Physically deleting rows from the listings table is not an option. Do you have any ideas on how I can do this? I initially tried using a temp table to hold the matching listing id's but I could not get figure out the update statement with this scenario.
Thanks for any help! I have been trying to hammer this out all night(I just started programming tsql)"
i am creating a database driven website and i am using a sql database. I have a database called company with fields in it to do with a company, I have created a company.cs file which sets the variables, properties and methods and so on. These work fine. I have also stored procedures and they are right as far as i know. i also have coding behind the buttons of my page when i try and update or insert to the database. I am having the problem of when i enter data into the text boxes and click update, nothing gets inserted or updated and whats worst of all no error message appears. The table is used for storing profile data about a user, when a user logs on they enter their profile data, if i manually enter this data and input the username of a user into the username field within the database then the data appears fine in the textboxes of the update info page but the data will not insert or update. i have checked all the little things and i am stressing out cos i am running out of time and cannot find the problem...........please could someone help me!!!!! thanks
Heres my coding to some of my pages to help you.... the code behind the button using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using FYPtestsite.Classes; public partial class Employer_employerprofile : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e) {if (!Roles.IsUserInRole(ConfigurationManager.AppSettings["employerrole"])) {Response.Redirect("~/Error1.aspx"); }Company objCompany = Company.GetCompany(Profile.UserName);if (objCompany != null) {
i wanted to ask how to insert values from a single web form into two sql tables, i have been looking and the visual web developer i use doesnt seam to allow me to even atempt it i've tried selecting all the values from two different tables and then adding those two tables to an insert function but it doesnt work likewise the update functioni have values in a table currently a reference number and i want to use this reference number to update the address values in this table so update this field.table1 and thisfield.table2 when ref number = @ refnumber the reference number is present in both tables and is linked PK to FK <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Back End DataConnectionString %>" SelectCommand="SELECT StartDetails.StartDetailsID, StartDetails.ContractIDNo, StartDetails.ContractName, StartDetails.NINO, StartDetails.AnticipatedStartDate, StartDetails.StartDateTime, StartDetails.StartDateLetterSent, StartDetails.StartDate, StartDetails.AnticipatedEndDate, StartDetails.ActualEndDate, StartDetails.ReasonForLeaving, StartDetails.Provider, StartDetails.AdviserReferrer, StartDetails.ProvisionCat, StartDetails.Provision, ClientDetails.NINO AS Expr1, ClientDetails.CentreNo, ClientDetails.FirstName, ClientDetails.SecondName, ClientDetails.AddressLine1, ClientDetails.AddressLine2, ClientDetails.PostCode, ClientDetails.ContactTelephoneNumber, ClientDetails.MobileNo, ClientDetails.Email, ClientDetails.DateOfBirth, ClientDetails.Gender, ClientDetails.PWD, ClientDetails.Ethnicity, ClientDetails.ClientGroup, ClientDetails.RepeatStartDate, ClientDetails.CaseworkerName, ClientDetails.ClientStatus, ClientDetails.PlacementDates, ClientDetails.JobsearchDay, ClientDetails.AchievedILP, ClientDetails.JobDate, ClientDetails.JobDate2, ClientDetails.JobDate3, ClientDetails.EligibleForRolledUpWeeks, ClientDetails.NoOfWeeksClaimed, ClientDetails.MarketingWhere, ClientDetails.Notes, ClientDetails.JobCentre, ClientDetails.JobCentreRep FROM StartDetails INNER JOIN ClientDetails ON StartDetails.NINO = ClientDetails.NINO WHERE (StartDetails.StartDetailsID = @StartDetailsID) AND (StartDetails.NINO = @NINO)" InsertCommand="INSERT INTO [StartDetails] ([NINO], [StartDate], [AnticipatedEndDate]) VALUES (@NINO, @StartDate, @AnticipatedEndDate)"
Hi, I'm trying to store large strings to a database, so am using thetext field type (LongText). I have used this before when storing thehtml of a webpage, and was able to store more than 255 characters byusing just a normal update sql statement. Now I'm trying to store thebody of research papers, and must be doing something different, as Ican only store 255 characters.Can someone explain why SQL Server doesn't like what I am doing -should I be using the WriteText / UpdateText function? If so, pleaseexplain by example how I would do that, and why doing that works.Thanks so much,Iain