Cannot Insert Duplicate Key In Object 'dbo.RunningJobs'
I'm using SSRS 2005 on a Server 2003 machine.
Some of my reports run fine but others take a long time to run and sometimes fail with an http error 503.
After a report errror happens I find entries in the event log that says: cannot open a connection to the report server
When I look at the log files for Reporting services I see an error caused by a primary key violation on the Running Jobs Table:
Violation of PRIMARY KEY constraint 'PK_RunningJobs'. Cannot insert duplicate key in object 'dbo.RunningJobs'
Does anyone know why do I get such errors?
Bellow is the error message in the logs:
w3wp!library!6!21/08/2006-09:30:22:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerDatabaseUnavailableException: The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerDatabaseUnavailableException: The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing. ---> System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_RunningJobs'. Cannot insert duplicate key in object 'dbo.RunningJobs'.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.ReportingServices.Library.RunningJobsDb.AddRunningJobs(Hashtable runningJobs)
View Complete Forum Thread with Replies
Related Forum Messages:
Cannot Insert Duplicate Key In Object 'dbo.RunningJobs'
We continue to recieve he following error on our RS 2005 SP1 Reporting Services installation: Violation of PRIMARY KEY constraint 'PK_RunningJobs'. Cannot insert duplicate key in object 'dbo.RunningJobs' This causes our server to become unresponsive and some reports to not render, Its becoming quite common. We reset IIS to correct it but is causes a service interuption. I know that it had been talked about before as something that may be fixed in SP2. But I do not see this referenced. Does anybody know of any fix for this? Thanks Ron
View Replies !
Cannot Insert Duplicate Key Row In Object
The following quote is the exact error message that I get when I attempt to create a pull subscription. The STAppointment is one of a 15 databases that need to replicate inorder for the application SalonTouch to run properly. What is causing this error? Is it user rights? Is it a problem with sql2005? Am I missing a step? Is there a problem with the database I am working with? What else? TITLE: New Subscription Wizard ------------------------------ SQL Server could not create a subscription for Subscriber 'D6LHWQ91PORTSUN9'. ------------------------------ ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ------------------------------ Cannot insert duplicate key row in object 'dbo.MSmerge_replinfo' with unique index 'uc1MSmerge_replinfo'. The subscription could not be created. The subscription properties table 'MSsubscription_properties' does not exist in the current database. Changed database context to 'STAppointment'. The statement has been terminated. (Microsoft SQL Server, Error: 2601) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.2047&EvtSrc=MSSQLServer&EvtID=2601&LinkId=20476 ------------------------------ BUTTONS: OK ------------------------------
View Replies !
Cannot Insert Duplicate Key Row In Object 'MSmerge_genhistory' With Unique Index 'unc1MSmerge_genhistory'
I have 1 client who keeps running into the following error on the subscriber and merge agents > €œCannot insert duplicate key row in object 'MSmerge_genhistory' with unique index 'unc1MSmerge_genhistory'.€? Last time we got this error I ran a reindex on table MSmerge_genhistory on the publisher database, I then successfully generated a new snapshot and the subscribers started to synchronize again. This time around I keep getting the error even after I follow these steps (I also ran all the jobs to clean up replication). The last time I ran into this error I created a job to reindex msmerge_genhistory on a nightly bases in an effort to avoid this problem. Can somebody please provide me with a workaround and also the reason why this error occurs in the first place. Thank you in advanced, Pauly C
View Replies !
Cannot Insert Duplicate Key Row In Object 'dbo.lastlogin' With Unique Index 'IX_lastlogin'.
Hi. I have been recently redesigning my tables - creating FK relationships from child tables to the PK userid in the Users table. The specifics of what I did and why can be seen here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1968856&SiteID=1 But, now I am getting the below error: Cannot insert duplicate key row in object 'dbo.lastlogin' with unique index 'IX_lastlogin'. The statement has been terminated. Or, for that matter, SavedSearches or any other table where I need to insert the same userid twice. I can see why I would want to avoid duplicates in the Users table. But, for lastlogin, savedsearches, and a few of my other tables, the same user may account for multiple rows. Any suggestions as to where I messed up and how to deal with this? Thanks. DBO.USERS Code Snippet CREATE TABLE [dbo].[users]( [userid] [int] IDENTITY(1,1) NOT NULL, [lastname] [varchar](50) NULL, [firstname] [varchar](50) NULL, [email] [varchar](50) NOT NULL, [alternateemail] [varchar](50) NULL, [password] [varchar](50) NOT NULL, [role] [varchar](10) NOT NULL, [securityquestion] [varchar](50) NOT NULL, [securityanswer] [varchar](50) NOT NULL, [zipcode] [int] NOT NULL, [birthmonth] [tinyint] NOT NULL, [birthday] [tinyint] NOT NULL, [birthyear] [int] NOT NULL, [gender] [varchar](10) NULL, [city] [varchar](50) NULL, [state] [varchar](50) NULL, [country] [varchar](50) NULL, [registerdate] [datetime] NOT NULL, [editdate] [datetime] NULL, [confirmed] [bit] NULL CONSTRAINT [DF__Users__confirmed__4CC05EF3] DEFAULT ((0)), CONSTRAINT [PK_users] PRIMARY KEY CLUSTERED ( [userid] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY], CONSTRAINT [IX_email] UNIQUE NONCLUSTERED ( [email] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF /****** Object: Table [dbo].[lastlogin] Script Date: 08/22/2007 14:16:16 ******/ SET ANSI_NULLS ON DBO.SAVEDSEARCHES CREATE TABLE [dbo].[savedsearches]( [savedsearchesid] [int] IDENTITY(1,1) NOT NULL, [searchname] [varchar](50) NOT NULL, [userid] [int] NOT NULL, [date] [datetime] NULL, [isdefault] [bit] NULL, [gender] [char](10) NULL, [startyear] [varchar](50) NULL, [endyear] [varchar](50) NULL, [country] [varchar](50) NULL, [miles] [int] NULL, [pictures] [varchar](50) NULL, [postal] [int] NULL, [sort] [tinyint] NULL, [photostring] [varchar](50) NULL, [orderby] [tinyint] NULL, CONSTRAINT [PK_SavedSearches] PRIMARY KEY CLUSTERED ( [userid] ASC, [searchname] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO ALTER TABLE [dbo].[savedsearches] WITH NOCHECK ADD CONSTRAINT [FK_savedsearches_users] FOREIGN KEY([userid]) REFERENCES [dbo].[users] ([userid]) GO ALTER TABLE [dbo].[savedsearches] CHECK CONSTRAINT [FK_savedsearches_users] GO SET QUOTED_IDENTIFIER ON GO The following insert statement returned the error in the subject because userid = 32 already exists in the Users table. INSERT INTO lastlogin VALUES (32, CONVERT(VARCHAR(26), GETDATE(), 109), 1, CONVERT(VARCHAR(26), GETDATE(), 109)) DBO.LASTLOGIN Code Snippet CREATE TABLE [dbo].[lastlogin]( [lastloginid] [int] IDENTITY(1,1) NOT NULL, [userid] [int] NOT NULL, [date] [datetime] NOT NULL, [status] [bit] NOT NULL CONSTRAINT [DF_lastlogin_status] DEFAULT ((0)), [activity] [datetime] NOT NULL CONSTRAINT [DF_lastlogin_activity] DEFAULT (getutcdate()), [online] AS (case when [status]=(1) AND datediff(minute,[activity],getutcdate())<(30) then (1) else (0) end), CONSTRAINT [PK_lastlogin] PRIMARY KEY CLUSTERED ( [date] ASC, [userid] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO ALTER TABLE [dbo].[lastlogin] WITH NOCHECK ADD CONSTRAINT [FK_lastlogin_users] FOREIGN KEY([userid]) REFERENCES [dbo].[users] ([userid]) GO ALTER TABLE [dbo].[lastlogin] CHECK CONSTRAINT [FK_lastlogin_users]
View Replies !
Cannot Insert Duplicate Key Row In Object 'dbo.blabla..' With Unique Index 'Idx_blablabl'. The Statement Has Been Terminated. At
We are developing a project that is expected to hold TB of data and the back end used is SQL Server 2005. I have the following problem I have applied Nonclustered index over a column on a table. Designed a SP for insertion which caters for updation incase the criteria based on the input is met. The logic goes like this Incase there exists a row containing the value of the column that is indexed for uniqueness, there should be updation. If not there should be a new row created. However often there is an error message that is placed above. This happens only on some of the SPs and only on rare occasions. Can any body tell me if there is any problem with the SQL Server 2005 Thanks in advance R Suresh, SQLDBA
View Replies !
CREATE TABLE DUPLICATE OBJECT/DUPLICATE FIELD NAME ERROR Msg 2714
Hello Everyone: I am using the Import/Export wizard to import data from an ODBC data source. This can only be done from a query to specify the data to transfer. When I try to create the tables, for the query, I am getting the following error: Msg 2714, Level 16, State 4, Line 12 There is already an object named 'UserID' in the database. Msg 1750, Level 16, State 0, Line 12 Could not create constraint. See previous errors. I have duplicated this error with the following script: USE [testing] IF OBJECT_ID ('[testing].[dbo].[users1]', 'U') IS NOT NULL DROP TABLE [testing].[dbo].[users1] CREATE TABLE [testing].[dbo].[users1] ( [UserID] bigint NOT NULL, [Name] nvarchar(25) NULL, CONSTRAINT [UserID] PRIMARY KEY (UserID) ) IF OBJECT_ID ('[testing].[dbo].[users2]', 'U') IS NOT NULL DROP TABLE [testing].[dbo].[users2] CREATE TABLE [testing].[dbo].[users2] ( [UserID] bigint NOT NULL, [Name] nvarchar(25) NULL, CONSTRAINT [UserID] PRIMARY KEY (UserID) ) IF OBJECT_ID ('[testing].[dbo].[users3]', 'U') IS NOT NULL DROP TABLE [testing].[dbo].[users3] CREATE TABLE [testing].[dbo].[users3] ( [UserID] bigint NOT NULL, [Name] nvarchar(25) NULL, CONSTRAINT [UserID] PRIMARY KEY (UserID) ) I have searched the "2714 duplicate error msg," but have found references to duplicate table names, rather than multiple field names or column name duplicate errors, within a database. I think that the schema is only allowing a single UserID primary key. How do I fix this? TIA
View Replies !
Msg 2714, Duplicate Object Error
Existing database (upgrade to SS2k5) has four tables with same primary key columns (UserID). Using CREATE TABLE with a specified [databasename].[dbo].[table1] schema is giving the following error message: Msg 2714, Level 16, State 4, Line 12 There is already an object named 'UserID' in the database. Msg 1750, Level 16, State 0, Line 12 Could not create constraint. See previous errors. I have duplicated the error with the following script: USE [testing] IF OBJECT_ID ('[testing].[dbo].[users1]', 'U') IS NOT NULL DROP TABLE [testing].[dbo].[users1] CREATE TABLE [testing].[dbo].[users1] ( [UserID] bigint NOT NULL, [Name] nvarchar(25) NULL, CONSTRAINT [UserID] PRIMARY KEY (UserID) ) IF OBJECT_ID ('[testing].[dbo].[users2]', 'U') IS NOT NULL DROP TABLE [testing].[dbo].[users2] CREATE TABLE [testing].[dbo].[users2] ( [UserID] bigint NOT NULL, [Name] nvarchar(25) NULL, CONSTRAINT [UserID] PRIMARY KEY (UserID) ) IF OBJECT_ID ('[testing].[dbo].[users3]', 'U') IS NOT NULL DROP TABLE [testing].[dbo].[users3] CREATE TABLE [testing].[dbo].[users3] ( [UserID] bigint NOT NULL, [Name] nvarchar(25) NULL, CONSTRAINT [UserID] PRIMARY KEY (UserID) ) I have searched the "2714 duplicate error msg," but have found references to duplicate table names, rather than multiple field names or column name duplicate errors within a database. I think that the schema is only allowing a single UserID primary key. How do I fix this? TIA
View Replies !
INSERT INTO... SELECT... Cannot Insert Duplicate Key...
I want to add the content of a table into anotherI tried to copy all fields, except the primary key:INSERT INTO table2(field2, field3, field4, ...)SELECT field2, field3, field4, ...FROM anotherDB.dbo.table1gives the following error:Violation of UNIQUE KEY constraint...Cannot insert duplicate key...Why?I didn't ask him to copy the key column; Isn't the SQL Server supposedto know how to increment the key ?
View Replies !
Cannot Insert Duplicate Key
I am using SQL Server 2000. I have a table (tbDupes) with duplicate records. I want to populate another table (tbUnique) with unique records. My tbDupes has about 50 columns and three of them make up my primary key in tbUnique. I thought I could get unique records by using the following SQL statement. Code Snippet INSERT INTO tbUnique SELECT * FROM tbDupes I received this error: Cannot insert duplicate key Is there a database setting that will allow me to insert the first record and prevent any duplicates from being inserted? I thought this was the default behavior and think that maybe the DBA changed it. I know I can achieve this by creating a cursor with tbDupes and then something like "IF NOT EXISTS(...) THEN INSERT". However, I would prefer to avoid using a cursor.
View Replies !
Cannot Insert Duplicate Key Row In Msrepl_transactions
We have an issue that our SQL Replication between our Application Server (holding 13 months of data) and our Reporting Server (holding 5-6 years of data). Both systems are running on NT4, SQL Server 7 Ent SP3. Our issue is that we used to run SQL Replication but then stopped using it, and used another method of replicating our data from the App Svr to Rpt Svr. However, we have now been told that we have to use SQL Replication. We set it up as usual, but when the log reader starts up, it finds the 1st transaction and moves it into the distribution database, but it then fails when attempting to do the 2nd transaction with the error "Cannot insert duplicate key row in object MSrepl_transactions with unique index ucMSrepl_transactions. We have checked the tables in the publisher db and they don't hold any duplicates, so I can only assume the key it is talking about is the key field in the distribution database, but this is a Binary field which I believe is populated by replication itself!! Is this correct? If so, why is it trying to enter duplicates? And can we resync replication to fix it?
View Replies !
Don't Insert Duplicate Rows
Hi, I need to insert rows into table1 from table2 and table3 but I don't want to insert repeated combinations of col2, col3. So, table1 has the primary key col2, col3. This the table1: create table table1( col1 int not null, col2 int not null, col3 int not null, constraint PK_table1 primary key (col2, col3) ) This is my "insert" code: INSERT INTO table1 SELECT table2.col1,table2.col2, table3.col3 FROM table2, table3 WHERE table2.col1 = table3.col1 Wich conditions shoud i add to this code? Thanks. fmilano.
View Replies !
Trying To Append A Field If An Insert Happens To Contain A Duplicate
I deliberately intend to add some duplicates to one of my tables. For eg Job User IsAdmin JobID 235User ID 1 JobID 235User ID 5 JobID 235User ID 9 JobID 235User ID 5 JobID 235User ID 2 JobID 235User ID 9 JobID 235User ID 10 JobID 235User ID 1 I know its bad practice to do such a thing but there is a genuine reason. What I need to do is to be able to have a SQL statement that appends true to the IsAdmin field whenever it encounters the next UserID thats happens to be a duplicate. Hence the above would look like: Job User IsAdmin JobID 235User ID 1 JobID 235User ID 5 JobID 235User ID 9 JobID 235User ID 5 True JobID 235User ID 2 JobID 235User ID 9 True JobID 235User ID 10 JobID 235User ID 1 True Thanks
View Replies !
Preventing Duplicate Rows On Insert
I have a table using an identity column as its Primary Key and twocolumns (table reduced for simplicity) EmployeeNumber and ArrivalTime.CREATE TABLE [tblRecords] ([ID] [bigint] IDENTITY (1, 1) NOT NULL ,[EmployeeNumber] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_ASNOT NULL ,[ArrivalTime] [datetime] NOT NULL ,CONSTRAINT [PK_tblRecords] PRIMARY KEY CLUSTERED([ID]) ON [PRIMARY]) ON [PRIMARY]GOI have an insert procedure that checks for duplicates before insertinga new record:IF (SELECT TOP 1 [ID] FROM tblRecords WHERE EmployeeNumber =@SocialSecurity) IS NULLBEGININSERT INTO tblRecords(EmployeeNumber,ArrivalTime)VALUES (@EmployeeNumber, @ArrivalTime)SELECT SCOPE_IDENTITY()ENDELSESELECT 0 AS DuplicateRecordIn 99.9% of the cases, this works well. However, in the event that theinsert attempts are literally "ticks" apart, the "SELECT TOP 1..."command completes on both attempts before the first attempt completes.So I end up with duplicate entries if the procedure is called multipletimes vey quickly. The system needs to prevent duplicateEmployeeNumbers within the past 45 days so setting the EmployeeNumberto UNIQUE would not work. I can check for older entries (45 days ornewer) very easily, but I do not know how to handle the times when theprocedure is called multiple times within milliseconds. Would aTRANSACTION with a duplicate check after the INSERT with a ROLLBACKwork in this case? Any help is greatly appreciated!-E
View Replies !
Conditional Insert - Duplicate Key Issue
I am in the process of migrating an old access database into a new SQL Server 2000 database with a modified structure. Tables: [Chapters][Worksite][Employers] I want to insert into the chapters table a ChapterID(PK), EmployerID(FK), and ChapterName. All of the selected information is coming from the [Worksite] table. However, my conditional is based on a third table, the [Employers] table. Below is a copy of a query that returns the result set I would like to insert into my [Chapters] table. Code: Select distinct a.WorksiteCode, b.employerID, a.WorksiteName From Worksite a, employers b Where a.worksiteCode = b.employerWSCode When I run this query it appears to return the proper result set. However, when I turn that query into an insert statement: Code: SET IDENTITY_INSERT Chapters ON Insert into Chapters (chapterID, employerID, chapterName) Select distinct a.WorksiteCode, b.employerID, a.WorksiteName From Worksite a, employers b Where a.worksiteCode = b.employerWSCode SET IDENTITY_INSERT Chapters OFF I recieve the following error message: Server: Msg 2627, Level 14, State 1, Procedure InsertChapterFromFixed, Line 10 Violation of PRIMARY KEY constraint 'PK_Chapters'. Cannot insert duplicate key in object 'Chapters'. The statement has been terminated. Anyone have any idea on how I can avoid this error message... either my distinct statement is not function as I expect it to, or I am doing something else wrong. Thanks for any help.
View Replies !
Insert That Drops Duplicate Records
I ought to know how to do this, but it escapes me at the moment. I need to write an insert statement for a table that will be based on a complex select query. The select query may return rows that are already in the target table. In that case, I don't want duplicates created, but I don't want the query to error, either. I can't remember how to set that up.
View Replies !
Error Message On Attempted Duplicate Insert
Hi All, I have a web form that inserts information into two tables in sql 2005 database on a submit button click. I have a unique key on the tables preventing duplicate information which works fine. The problem I have is that at the minute if a users tries to insert a duplicate row they just get the built in sql error message. Is there a way I can validate the information before if goes into the database and display perhaps a label telling the user of their error or is there a way I can customize the build in sql error message? I've had a search on various forums and sites and can't find any info that would help me. Thanks in advance Dave
View Replies !
Duplicate Records Are Being Inserted With One Insert Command.
This is like the bug from hell. It is kind of hard to explain, soplease bear with me.Background Info: SQL Server 7.0, on an NT box, Active Server pageswith Javascript, using ADO objects.I'm inserting simple records into a table. But one insert command isplacing 2 or 3 records into the table. The 'extra' records, have thesame data as the previous insert incident, (except for the timestamp).Here is an example. Follow the values of the 'Search String' field:I inserted one record at a time, in the following order (And only oneinsert per item):airplanejetdogcatmousetigerAfter this, I should have had 6 records in the table. But, I endedup with 11!Here is what was recorded in the database:Vid DateTime Type ProductName SearchString NumResultscgcgGeorgeWeb3 Fri Sep 26 09:48:26 PDT 2003 i null airplane 112cgcgGeorgeWeb3 Fri Sep 26 09:49:37 PDT 2003 i null jet 52cgcgGeorgeWeb3 Fri Sep 26 09:50:00 PDT 2003 i null dog 49cgcgGeorgeWeb3 Fri Sep 26 09:50:00 PDT 2003 i null jet 52cgcgGeorgeWeb3 Fri Sep 26 09:50:00 PDT 2003 i null jet 52cgcgGeorgeWeb3 Fri Sep 26 09:50:22 PDT 2003 i null dog 49cgcgGeorgeWeb3 Fri Sep 26 09:50:22 PDT 2003 i null cat 75cgcgGeorgeWeb3 Fri Sep 26 09:52:53 PDT 2003 i null mouse 64cgcgGeorgeWeb3 Fri Sep 26 09:53:06 PDT 2003 i null tiger 14cgcgGeorgeWeb3 Fri Sep 26 09:53:06 PDT 2003 i null mouse 64cgcgGeorgeWeb3 Fri Sep 26 09:53:06 PDT 2003 i null mouse 64Look at the timestamps, and notice which ones are the same.I did one insert for 'dog' , but notice how 2 'jet' records wereinsertedat the same time. Then, when I inserted the 'cat' record, another'dog' record was inserted. I waited awhile, and inserted mouse, andonly the mouse was inserted. But soon after, I inserted 'tiger', and 2more mouse records were inserted.If I wait awhile between inserts, then no extra records are inserted.( Notice 'airplane', and the first 'mouse' entries. ) But if I insertrecords right after one another, then the second record insertion alsoinserts a record with data from the 1st insertion.Here is the complete function, in Javascript (The main code ofinterestmay start at the Query = "INSERT ... statement):----------------------------------------------------------------------//Write SearchTrack Record ------------------------------------Search.prototype.writeSearchTrackRec = function(){Response.Write ("<br>Calling function writeSearchTrack "); // fordebugvar Query;var vid;var type = "i"; // Type is imagevar Q = "', '";var datetime = "GETDATE()";//Get the Vid// First - try to get from the outVid var of Cookieinctry{vid = outVid;}catch(e){vid = Request.Cookies("CGIVid"); // Gets cookie id valuevid = ""+vid;if (vid == 'undefined' || vid == ""){vid = "ImageSearchNoVid";}}try{Query = "INSERT SearchTrack (Vid, Type, SearchString, DateTime,NumResults) ";Query += "VALUES ('"+vid+Q+type+Q+this.searchString+"',"+datetime+","+this.numResults+ ")";this.cmd.CommandText = Query;this.cmd.Execute();}catch(e){writeGenericErrLog("Insert SearchTrack failed", "Vid: "+vid+"- SearchString:: "+this.searchString+" - NumResults: "+this.numResults, e.description);}}//end-----------------------------------------------------------------I also wrote a non-object oriented function, and created the commandobject inside the function. But I had the same results.I know that the function is not getting called multiple timesbecause I print out a message each time it is called.This really stumps me. I'll really appreciate any help you canoffer.Thanks,George
View Replies !
'Cannot Insert Duplicate Key' Error With Identity Column As PK
I guess there is first for everything...I had never seen error like this before Violation of PRIMARY KEY constraint 'PK_table1'. Cannot insert duplicate key in object 'table1'. The statement has been terminated. In this case Primary Key is Identity column. I do not include Idenity column in Insert statement. Incidently SQL server machines had cluster failure couple of days before. I am not sure whether it has anything to do with it. I see this error randomly. How should I debug it
View Replies !
SP Causes The Error Violation Of UNIQUE KEY Constraint Cannot Insert Duplicate Key
The following SP causes the error "Violation of UNIQUE KEY constraint 'AlumniID'. Cannot insert duplicate key in object [table name]. The statement has been terminated." AlumniID is the table's PK and is set to autoincrement. I'd appreciate any help or suggestions. 1 ALTER PROCEDURE dbo.sp_CreateUser 2 3 @UserID uniqueidentifier, 4 @UserName nvarchar(128), 5 @Email nvarchar(50), 6 @FirstName nvarchar(25), 7 @LastName nvarchar(50), 8 @Teacher nvarchar(25), 9 @GradYr int 10 11 AS 12 SET NOCOUNT ON; 13 --DECLARE @UserID uniqueidentifier 14 --SELECT @UserID = NULL 15 --SELECT @UserID = UserID FROM dbo.aspnet_Users WHERE LOWER(@UserName) = LoweredUserName-- AND @ApplicationId = ApplicationId 16 INSERT INTO [table] 17 (UserID,UserName,Email,FirstName,LastName,Teacher,GradYr) 18 VALUES (@UserID,@UserName,@Email,@FirstName,@LastName,@Teacher,@GradYr
View Replies !
Problem Of Duplicate Records With A Simple Insert Statement !
I am using a simple stored proc shown below which inserts a record and updates the same record field called SortID with the Primary Key Column data of the same record.Everything was working fine until few days back. The site has been deployed 2 years back and was LIVE ever since. We have got thousands of records in this Credits table. The table field called SortID is used for moving the credits up and down. My problem is now after 2 years of deploying the table has got duplicate records, suprisingly a same credit is appearing under different MemberID and with the same SortID. How are these duplicate records inserted with a simple insert statement & update ?? Is this a Locking problem or Transaction problem I have no idea. Any ideas will be of great help Thanks in Advance Stored Procedure Used CREATE PROC SP_SC_INSERT (@memberID int,@title varchar(30),@dir varchar(30),@desc varchar(20))ASINSERT INTO [dbo].[Credits]([MemberID],[Title],[Director], [Description], )VALUES(@memberID,@title,@dir, @desc, )UPDATE Credits Set SortID = @@IDENTITY WHERE CreditID = @@IDENTITYGO
View Replies !
Duplicate Last Record When Using SqlDataAdapter.Update For Insert Command
I'm getting duplicate records for the last record in the datatable. No matter how much or how little my datatable contains row records, it always duplicate the last one for some reason. Is there something wrong with my code below? EXAMID pulling from another stored procedure, which is outputed back to a variable. ---Data Access Layer---- If dt.Rows.Count > 0 Then 'INSERT EXAM ROSTERInsertComm = New SqlCommandsqladapter = New SqlDataAdapterInsertComm = New SqlClient.SqlCommand("ExamOfficers_AddOfficerSpecificExamRoster", conndb)InsertComm.CommandType = CommandType.StoredProcedure sqladapter.InsertCommand = InsertCommInsertComm.Parameters.Add("@examid", SqlDbType.Int)InsertComm.Parameters("@examid").Value = examidInsertComm.Parameters.Add("@officerid", SqlDbType.Int, 12, "Officer_UID")InsertComm.Parameters.Add("@reimburse", SqlDbType.Bit, 12, "ReimburseToDb")InsertComm.Parameters.Add("@posttest", SqlDbType.Int, 12, "Post_Test")InsertComm.Parameters.Add("@pqcdate", SqlDbType.DateTime, 12, "pqc_date")InsertComm.Parameters.Add("@pqcscore", SqlDbType.Int, 12, "pqc_score") conndb.Open() sqladapter.UpdateBatchSize = 100InsertComm.UpdatedRowSource = UpdateRowSource.Nonesqladapter.Update(dt) InsertComm.ExecuteNonQuery()InsertComm.Dispose() End If ----Stored Procedure---- ALTER PROCEDURE [dbo].[ExamOfficers_AddOfficerSpecificExamRoster] @ExamID as int,@OfficerID as int,@reimburse as bit=NULL,@posttest as int=NULL,@pqcdate as datetime=NULL,@pqcscore as int=NULL ASBEGIN SET NOCOUNT ON; Insert Into Exam_Officers(EXAM_UID,Officer_UID,reimburse,post_test,pqc_date,pqc_score)values(@ExamID,@OfficerID,@reimburse,@posttest,@pqcdate,@pqcscore) END
View Replies !
Bulk Insert, Skip Rows With Duplicate Key Error?
Does sql server have a way to handle errors in a sproc which would allowone to insert rows, ignoring rows which would create a duplicate keyviolation? I know if one loops one can handle the error on a row by rowbasis. But is there a way to skip the loop and do it as a bulk insert?It's easy to do in Access, but I'm curious to know if SQL Server propercan handle like this. I am guessing that a looping operation would beslower to execute?
View Replies !
Duplicate Tables Insert/Update In Another Table? Triggers?
I want to be able to duplicate every single record that is inserted or updated in a particular table to another table, but not the delete. Is the best way to set-up a trigger? If so can anyone provide me with an example of how to do this? Also could you just duplicate certain columns in the row I would you have to do all columns? Thanks for help.
View Replies !
Insert OLE Object
I have an MS Access Database that has a field defined as a OLE object which is used to store CANVAS 6 diagrams. I would like to migrate this database to SQL Server but I cannot find a similar capability on SQL Server 2000. You would think that SQL Server 2000 could do anything that MS Access could do. Is there a way to handle this?
View Replies !
Insert From Formview And Checking Database To Avoid A Duplicate Entry
I have a form view that I am using to insert new data into a sql express database and would like to find a way to avoid attempting to insert a record if the key already exists. is there a way to do this with the formview insert command. Everything works great until I try to add a record with an already existing value in the unique key field, then it breaks.
View Replies !
Query Insert And Predicate On The Same Object
Hey all, I've a querie which inserts into a table, while joining on it. Something like: insert into table1 (columnA, columnB ) select (columnA,columnB) from table2 where columnA NOT EXIST(SELECT 1 from table1,table2 where table1.columnA!=table2.columnA) As a rule of thumb, I avoid subselects and negative logic. However, sql2k seems to pick the fastest execution plan using this query, using a left anti semi join on that subselect. My question is this; what are the repercussions of inserting into a table when sql2k has already picked a query plan based on its stats? Is deadlocking possible? I haven't been able to find any evidence one way or the other. My objects are several million rows, so I am expecting some sort of side effect. Any help would be greatly appreciated. Regards, -Kilka
View Replies !
DTS Transfer Object Task - IDENTITY INSERT?
Good Afternoon, Does anybody know if the DTS Transfer Object Task transfers tables with IDENTITY INSERT enabled? I'm copying objects, along with their data to another database, but I need to retain the values in my IDENTITY columns. I will do some manual checking but this is fairly tedious and error prone. I've checked the Books Online but I couldn't find anything that answers my question. Regards, Robin
View Replies !
How Do I Call A Insert Stored Procedure From A Data Flow Destination Object?
I want to insert data calling a stored procedure and call this from a Data Flow destination object. Is it possible? I understand that Ole Db Command transformation object can call stored procedure, but that will not rollback in the event of error in the middle. I understand that Ole Db Destination object will rollback in middle of import, but I don't see how to do the insert by calling stored procedure. "Sql Command" option in Ole Db Destination object does not seem to present solution to the problem. Am I missing something here or is Ssis / Microsoft demanding that Insert stored procedure not be used when using Data Flow destination object to insert data into target table?
View Replies !
TOUGH INSERT: Copy Sale Record/Line Items For &"Duplicate&" Record
I have a client who needs to copy an existing sale. The problem isthe Sale is made up of three tables: Sale, SaleEquipment, SaleParts.Each sale can have multiple pieces of equipment with correspondingparts, or parts without equipment. My problem in copying is when I goto copy the parts, how do I get the NEW sale equipment ids updatedcorrectly on their corresponding parts?I can provide more information if necessary.Thank you!!Maria
View Replies !
Server Error: Object Reference Not Set To An Instance Of An Object. Trying To Upload Image In Database
Does any one has any clue for this error ? I did went through a lot of articles on this error but none helped . I am working in Visual studie 2005 and trying to upload image in sql database through a simple form. Here is the code using System; using System.Data; using System.Configuration; using System.Collections; 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 System.Data.SqlClient; using System.Web.Configuration; using System.IO; public partial class Binary_frmUpload : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e) { }protected void btnUpload_Click(object sender, EventArgs e) {if (FileUpload.HasFile == false) { // No file uploaded!lblUploadDetails.Text = "Please first select a file to upload..."; } else {string str1 = FileUpload.PostedFile.FileName; string str2 = FileUpload.PostedFile.ContentType; string connectionString = WebConfigurationManager.ConnectionStrings["GSGA"].ConnectionString; //Initialize SQL Server Connection SqlConnection con = new SqlConnection(connectionString); //Set insert query string qry = "insert into Officers (Picture,PictureType ,PicttureTitle) values(@ImageData, @PictureType, @PictureTitle)"; //Initialize SqlCommand object for insert. SqlCommand cmd = new SqlCommand(qry, con); //We are passing Original Image Path and Image byte data as sql parameters. cmd.Parameters.Add(new SqlParameter("@PictureTitle", str1)); cmd.Parameters.Add(new SqlParameter("@PictureType", str2));Stream imgStream = FileUpload.PostedFile.InputStream; int imgLen = FileUpload.PostedFile.ContentLength;byte[] ImageBytes = new byte[imgLen]; cmd.Parameters.Add(new SqlParameter("@ImageData", ImageBytes)); //Open connection and execute insert query. con.Open(); cmd.ExecuteNonQuery(); con.Close(); //Close form and return to list or images. } } } Object reference not set to an instance of an object. 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.NullReferenceException: Object reference not set to an instance of an object.Source Error: Line 32: Line 33: string str2 = FileUpload.PostedFile.ContentType; Line 34: string connectionString = WebConfigurationManager.ConnectionStrings["GSGA"].ConnectionString; Line 35: Line 36: //Initialize SQL Server Connection Source File: c:UsersManojDocumentsVisual Studio 2005WebSitesGSGABinaryfrmUpload.aspx.cs Line: 34 Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] Binary_frmUpload.btnUpload_Click(Object sender, EventArgs e) in c:UsersManojDocumentsVisual Studio 2005WebSitesGSGABinaryfrmUpload.aspx.cs:34 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
View Replies !
' The Definition Of Object [object Name] Has Changed Since It Was Compiled' Error When Altering A Trigger In 2005
Hello All Not sure if this is the right forum to post this question to, so if it's not, please accept my apologies. I'm working in SQL Server 2005 with a database that was migrated to 2005 from SQL Server 2000. I have to alter a trigger on a table for some functionality changes, and when I modify the trigger and then access it through the application the database is working with, I receive this error: There was a error in the [stored procedure name] procedure. Error Number: -2147217900 Error Description: [Microsoft][ODBC SQL Server Driver][SQL Server]The definition of object '[trigger name]' has changed since it was compiled. [stored procedure name] and [trigger name] are where the actual names appear in the message. I've tried running sp_recompile on the trigger, stored procedure, and table that are associated with this, and nothing works. I have dropped the trigger, which allows the save process to complete (but doesn't perform the required functionality, of course), and then re-created the trigger, but the error message still comes up. The compatibility level for the database is SQL Server 2000 (80) (as it was migrated from SQL Server 2000 as I mentioned above). Has anyone seen this, and if so, how can I fix it? Thanks in advance for your help! Jay
View Replies !
When Using A Sqldataadapter In VS 2005 I Get The Following Error At Runtime. Object Reference Not Set To An Instance Of An Object
Help! I have posted this before and I had hoped that the VS2005 SP1 would help my problem. It didn't. My code is shown below. I have dropped a sqlconnection, sqldataadapter and a strongly-typed dataset from the toolbox onto the component designer for my page and written my code. It compiles without any errors but at runtine I receive the system error "Object reference not set to an instance of an object." The error occurs at the first line where the sqldataadapter is mentioned. I have shufflled the code and the error still occurs at first mention of the dataadapter. I have set parameters to a simple string such as "myemail." It hasn't helped. I have used the "Dim" statement as "Dim DaAuthorLogin as System.Data.SqlClient.SqlDataadapter and Dim DaAuthorLogin as New ......) at the start of the private sub generated by the event requiring the data. Nothing helps. Here is my simple code to select data from a sqlserver 2000 database. Why do I continue to get this error? Partial Class AuthorLogin Inherits System.Web.UI.Page Protected WithEvents AuthorInformation As System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand Me.DaAuthorLogin = New System.Data.SqlClient.SqlDataAdapter Me.MDData = New System.Data.SqlClient.SqlConnection Me.DsAuthorLogin = New MedicalDecisions.DsAuthorLogin CType(Me.DsAuthorLogin, System.ComponentModel.ISupportInitialize).BeginInit() ' 'SqlSelectCommand1 ' Me.SqlSelectCommand1.CommandText = "SELECT AuthorAlias, AuthorEmail, AuthorPassword, LastName, PreferredName" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "FRO" & _ "M T_Author" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "WHERE (AuthorEmail = @AuthorEmail) AND (AuthorPassword =" & _ " @AuthorPassword)" Me.SqlSelectCommand1.Connection = Me.MDData Me.SqlSelectCommand1.Parameters.AddRange(New System.Data.SqlClient.SqlParameter() {New System.Data.SqlClient.SqlParameter("@AuthorEmail", System.Data.SqlDbType.NVarChar, 50, "AuthorEmail"), New System.Data.SqlClient.SqlParameter("@AuthorPassword", System.Data.SqlDbType.NVarChar, 50, "AuthorPassword")}) ' 'DaAuthorLogin ' Me.DaAuthorLogin.SelectCommand = Me.SqlSelectCommand1 Me.DaAuthorLogin.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "T_Author", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("AuthorAlias", "AuthorAlias"), New System.Data.Common.DataColumnMapping("AuthorEmail", "AuthorEmail"), New System.Data.Common.DataColumnMapping("AuthorPassword", "AuthorPassword"), New System.Data.Common.DataColumnMapping("LastName", "LastName"), New System.Data.Common.DataColumnMapping("PreferredName", "PreferredName")})}) ' 'MDData ' Me.MDData.ConnectionString = "Data Source=CIS1022DAVID;Initial Catalog=CGData;Integrated Security=True;Pooling" & _ "=False" Me.MDData.FireInfoMessageEventOnUserErrors = False ' 'DsAuthorLogin ' Me.DsAuthorLogin.DataSetName = "DsAuthorLogin" Me.DsAuthorLogin.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema CType(Me.DsAuthorLogin, System.ComponentModel.ISupportInitialize).EndInit() End Sub Friend WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand Friend WithEvents MDData As System.Data.SqlClient.SqlConnection Friend WithEvents DaAuthorLogin As System.Data.SqlClient.SqlDataAdapter Friend WithEvents DsAuthorLogin As MedicalDecisions.DsAuthorLogin 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 'no code here End Sub Private Sub AuthorLoginRegister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorLoginRegister.Click 'for new author registration Response.Redirect("AuthorInformation.aspx") End Sub Private Sub AuthorLoginBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorLoginBack.Click 'to navigate back Response.Redirect("MainPaths.aspx") End Sub Protected Sub AuthorLoginPassword_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorLoginPassword.TextChanged 'pass the parameters to the dataadapter and return dataset DaAuthorLogin.SelectCommand.Parameters("@AuthorEmail").Value = AuthorLoginEmail.Text DaAuthorLogin.SelectCommand.Parameters("@AuthorPassword").Value = AuthorLoginPassword.Text MDData.Open() DaAuthorLogin.Fill(DsAuthorLogin, "T_Author") MDData.Close() 'set session objects If DsAuthorLogin.T_Author.Rows.Count > 0 Then Session("AuthorAlias") = DsAuthorLogin.T_Author(0).AuthorAlias Session("LastName") = DsAuthorLogin.T_Author(0).LastName Session("PreferredName") = DsAuthorLogin.T_Author(0).PreferredName Response.Redirect("AuthorPaths.aspx") Else : AuthorLoginNotValid.Visible = True AuthorLoginEmail.Text = "" AuthorLoginPassword.Text = "" End If End Sub End Class Thanks in advance, David
View Replies !
Error: The Script Threw An Exception: Object Reference Not Set To An Instance Of An Object.
Anyone know what this error means and how to get rid of it? Public Sub Main() Dim myMessage As Net.Mail.MailMessage Dim mySmtpClient As Net.Mail.SmtpClient myMessage.To(20) = New Net.Mail.MailAddress(me@hotmail.com) myMessage.From = New Net.Mail.MailAddress(someone@microsoft.com) myMessage.Subject = "as;dlfjsdf" myMessage.Priority = Net.Mail.MailPriority.High mySmtpClient = New Net.Mail.SmtpClient("microsoft.com") mySmtpClient.Send(myMessage) Dts.TaskResult = Dts.Results.Success End Sub Thanks,
View Replies !
Delete SQL Script As400 Throwing Object Reference Not Set To An Instance Of An Object
I am trying to send some data back to our as/400 from SQL server. Before I do so I need to delete entries from the table. I have an odbc connection set up and have used it sucessfully in a datareader compoenent but but when I try to use it for a delete SQL task it give me the followign error. what am I doing wrong? I even tried hardcoding in the system name/library name. Here is my delete sql script DELETE FROM DSSCNTL Where Companycode = 10 TITLE: SQL Task ------------------------------ Object reference not set to an instance of an object. ------------------------------ BUTTONS: OK ------------------------------
View Replies !
Predict Query Gives 'DMPluginWrapper; Object Reference Not Set To An Instance Of An Object' Error
Hi, I am trying to develop a custom algorithm. I have implemented and tested training methods, however I fail at prediction phase. When I try to run a prediction query against a model created with my algorithm I get: Executing the query ... Obtained object of type: Microsoft.AnalysisServices.AdomdClient.AdomdDataReader COM error: COM error: DMPluginWrapper; Object reference not set to an instance of an object.. Execution complete I know this is not very descriptive, but I have seen that algorith doesn't even executes my Predict(..) function (I can test this by logging to a text file) So the problem is this, when I run prediction query DMPluginWrapper gives exception -I think- even before calling my custom method. As I said it is not a very descriptive message but I hope I have hit a general issue. Thanks...
View Replies !
Object Reference Not Set To An Instance Of An Object. MSSQL Server Report Builder
When I try and run Report Builder Reports i get this error message "Object reference not set to an instance of an object. " I can run reports locally but not from Report manager here is the stack trace info Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] Microsoft.Reporting.WebForms.WebRequestHelper.GetExceptionForMoreInformationNode(XmlNode moreInfo, XmlNamespaceManager namespaces) +18 Microsoft.Reporting.WebForms.WebRequestHelper.ExceptionFromWebResponse(Exception e) +358 Microsoft.Reporting.WebForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension) +482 Microsoft.Reporting.WebForms.ServerReport.InternalRender(Boolean isAbortable, String format, String deviceInfo, NameValueCollection urlAccessParameters, Stream reportStream, String& mimeType, String& fileNameExtension) +958 Microsoft.Reporting.WebForms.ServerReportControlSource.RenderReport(String format, String deviceInfo, NameValueCollection additionalParams, String& mimeType, String& fileExtension) +84 Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +143 Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +75 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64 Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
View Replies !
Microsoft Visual Studio Is Unable To Load This Document: Object Reference Is Not Set To An Instance Of An Object
Hi Everyone, Please help me on this issue. I'm a new SSIS User. I've installed Sql Server 2005 Developer Edition When I create a new SSIS Project in Business Intelligence Development Studio, I get the following message: "Microsoft Visual Studio is unable to load this document: Object reference is not set to an instance of an object". Error loading 'package.dtsx'bject reference is not set to an instance of an object When I try to debug the package, I get the below message: parameter Component(System.Design) is null. I've uninstalled and installed SS 2005 several times, yet the problem persists. Please help. This is the package.dtsx <?xml version="1.0"?><DTS:Executable xmlnsTS="www.microsoft.com/SqlServer/Dts" DTS:ExecutableType="MSDTS.Package.1"><DTSroperty DTS:Name="PackageFormatVersion">2</DTSroperty><DTSroperty DTS:Name="VersionComments"></DTSroperty><DTSroperty DTS:Name="CreatorName">USkothand1</DTSroperty><DTSroperty DTS:Name="CreatorComputerName">US6051KOTHAND1</DTSroperty><DTSroperty DTS:Name="CreationDate" DTSataType="7">4/8/2008 10:53:39 AM</DTSroperty><DTSroperty DTS:Name="PackageType">5</DTSroperty><DTSroperty DTS:Name="ProtectionLevel">1</DTSroperty><DTSroperty DTS:Name="MaxConcurrentExecutables">-1</DTSroperty><DTSroperty DTS:Name="PackagePriorityClass">0</DTSroperty><DTSroperty DTS:Name="VersionMajor">1</DTSroperty><DTSroperty DTS:Name="VersionMinor">0</DTSroperty><DTSroperty DTS:Name="VersionBuild">0</DTSroperty><DTSroperty DTS:Name="VersionGUID">{FBD98635-EDDE-4F58-9D53-356E8CB653FB}</DTSroperty><DTSroperty DTS:Name="EnableConfig">0</DTSroperty><DTSroperty DTS:Name="CheckpointFileName"></DTSroperty><DTSroperty DTS:Name="SaveCheckpoints">0</DTSroperty><DTSroperty DTS:Name="CheckpointUsage">0</DTSroperty><DTSroperty DTS:Name="SuppressConfigurationWarnings">0</DTSroperty><DTSroperty DTS:Name="ForceExecValue">0</DTSroperty><DTSroperty DTS:Name="ExecValue" DTSataType="3">0</DTSroperty><DTSroperty DTS:Name="ForceExecutionResult">-1</DTSroperty><DTSroperty DTS:Name="Disabled">0</DTSroperty><DTSroperty DTS:Name="FailPackageOnFailure">0</DTSroperty><DTSroperty DTS:Name="FailParentOnFailure">0</DTSroperty><DTSroperty DTS:Name="MaxErrorCount">1</DTSroperty><DTSroperty DTS:Name="ISOLevel">1048576</DTSroperty><DTSroperty DTS:Name="LocaleID">1033</DTSroperty><DTSroperty DTS:Name="TransactionOption">1</DTSroperty><DTSroperty DTS:Name="DelayValidation">0</DTSroperty> <DTS:LoggingOptions><DTSroperty DTS:Name="LoggingMode">0</DTSroperty><DTSroperty DTS:Name="FilterKind">1</DTSroperty><DTSroperty DTS:Name="EventFilter" DTSataType="8"></DTSroperty></DTS:LoggingOptions><DTSroperty DTS:Name="ObjectName">Package</DTSroperty><DTSroperty DTS:Name="DTSID">{191D188C-EA6E-46D6-A46A-8C9F3C21C321}</DTSroperty><DTSroperty DTS:Name="Description"></DTSroperty><DTSroperty DTS:Name="CreationName">MSDTS.Package.1</DTSroperty><DTSroperty DTS:Name="DisableEventHandlers">0</DTSroperty></DTS:Executable> Thanks Best Regards
View Replies !
Problem In Converting MS Access OLE Object[Image] Column To BLOB (binary Large Object Bitmap)
Hi All, i have a table in MS Access with CandidateId and Image column. Image column is in OLE object format. i need to move this to SQL server 2005 with CandidateId column with integer and candidate Image column to Image datatype. its very udgent, i need any tool to move this to SQL server 2005 or i need a code to move this table from MS Access to SQL server 2005 in C#. please do the needfull ASAP. waiting for your reply with regards
View Replies !
VS 2005 Error 'Object Reference Not Set To An Instance Of An Object' With Integration Services Project Create Failure
Just installed VS 2005 & SQLServer 2005 clients on my workstation. When trying to create a new Integration Services Project and start work in the designer receive the MICROSOFT VISUAL STUDIO 'Object reference not set to an instance of an object.' dialog box with message "Creating project 'Integration Services project1'...project creation failed." Previously I had SQLServer 2000 client with the little VS tool that came with it installed. Uninstalled these prior to installing the 2005 tools (VS and SQLServer). I'm not finding any information on corrective action for this error. Any one have this problem and found the solution? Thanks, CLC
View Replies !
Update Problem, Error: Object Reference Not Set To An Instance Of An Object
Hi, Hi created a Data adapter to get some info out of my SQLExpress database. First I linked the data adapter to a gridview, and tested if I could gather, update,delete and insert info into tthe database through this gridview. No problems. But because I want tot work with the data before I update my db tables, I've created a Business Layer between the adapter and gridview. The busines layer consists of a object representing a country and methods to get, update, delete and isert data out and in of the DB. I use an objectdatasource in my presentation page to link the methonds with the insert, eduit and delete buttons of the gridview. Inserting and deleting entries is no porblem at all, editing the info however generates the following error: "Object reference not set to an instance of an object" Normally this means that you hace declared an variable, but you have still to create an instance, usung the New() method or provide an value for this object. Problem is, if a try to add the new() method then i get the error "Error 1 Argument not specified for parameter 'rb' of 'Friend Sub New(rb As System.Data.DataRowBuilder)' Can someone help me, I'm out of ideas! It's just the update method that is not working, the rest works fine. Imports Microsoft.VisualBasic Imports CountriesTableAdapters Imports System.DataImports System.Data.SqlClient Public Class Country Private _Country_ID As Integer Private _ISO, _NL, _FR, _ENG, _Continent, _Remarks As String Private _Enabled As Boolean Public Property Country_ID() As Integer GetReturn _Country_ID End GetSet(ByVal Value As Integer) _Country_ID = CInt(Value) End Set End Property Public Property ISO() As String GetReturn _ISO End GetSet(ByVal Value As String) _ISO = Trim(Value.ToString) End Set End Property Public Property NL() As String GetReturn _NL End GetSet(ByVal Value As String) _NL = Trim(Value.ToString) End Set End Property Public Property FR() As String GetReturn _FR End GetSet(ByVal Value As String) _FR = Trim(Value.ToString) End Set End Property Public Property ENG() As String GetReturn _ENG End GetSet(ByVal Value As String) _ENG = Trim(Value.ToString) End Set End Property Public Property Continent() As String GetReturn _Continent End GetSet(ByVal Value As String) _Continent = Trim(Value.ToString) End Set End Property Public Property Remarks() As String GetReturn _Remarks End GetSet(ByVal Value As String) _Remarks = Trim(Value.ToString) End Set End Property Public Property Enabled() As Boolean GetReturn _Enabled End GetSet(ByVal Value As Boolean) _Enabled = CBool(Value) End SetEnd PropertyEnd Class Public Class Countries Private _CountriesAdapter As CountriesTableAdapter = NothingProtected ReadOnly Property Adapter() As CountriesTableAdapter Get If _CountriesAdapter Is Nothing Then_CountriesAdapter = New CountriesTableAdapter End IfReturn _CountriesAdapter End Get End PropertyPublic Function GetCountries() As CountriesDataTable Return Adapter.GetCountries End FunctionPublic Sub AddCountry(ByVal ObjCountry As Country) Dim CountriesTbl As New CountriesDataTableDim CountryRw As CountriesRow = CountriesTbl.NewCountriesRow With ObjCountry If String.IsNullOrEmpty(.ISO) ThenThrow New ArgumentException("ISO afkorting is verpicht", "ISO") Else CountryRw.ISO = .ISO End If If String.IsNullOrEmpty(.NL) ThenThrow New ArgumentException("Landsnaam is verpicht", "NL") Else CountryRw.NL = .NL End If If String.IsNullOrEmpty(.FR) ThenThrow New ArgumentException("Landsnaam is verpicht", "FR") Else CountryRw.FR = .FR End If If String.IsNullOrEmpty(.ENG) ThenThrow New ArgumentException("Landsnaam is verpicht", "ENG") Else CountryRw.ENG = .ENG End If If String.IsNullOrEmpty(.Continent) ThenThrow New ArgumentException("Continent is verpicht", "Continent") Else CountryRw.Continent = .Continent End If If String.IsNullOrEmpty(.Remarks) Then CountryRw.SetRemarksNull() Else CountryRw.Remarks = .Remarks End If CountryRw.Enabled = .Enabled End With 'Voeg nieuwe rij toe aan bestaande countriestable CountriesTbl.AddCountriesRow(CountryRw) 'Voeg nieuw land toe aan de Database Adapter.Update(CountriesTbl) End SubPublic Sub UpdateCountry(ByVal ObjCountry As Country) Dim CountriesTbl As New CountriesDataTableDim CountryRw As CountriesRow CountryRw = CountriesTbl.FindByCountry_ID(ObjCountry.Country_ID) If String.IsNullOrEmpty(ObjCountry.ISO) ThenThrow New ArgumentException("ISO afkorting is verpicht", "ISO") Else CountryRw.ISO = ObjCountry.ISO End If If String.IsNullOrEmpty(ObjCountry.NL) ThenThrow New ArgumentException("Landsnaam is verpicht", "NL") Else CountryRw.NL = ObjCountry.NL End If If String.IsNullOrEmpty(ObjCountry.FR) ThenThrow New ArgumentException("Landsnaam is verpicht", "FR") Else CountryRw.FR = ObjCountry.FR End If If String.IsNullOrEmpty(ObjCountry.ENG) ThenThrow New ArgumentException("Landsnaam is verpicht", "ENG") Else CountryRw.ENG = ObjCountry.ENG End If If String.IsNullOrEmpty(ObjCountry.Continent) ThenThrow New ArgumentException("Continent is verpicht", "Continent") Else CountryRw.Continent = ObjCountry.Continent End If If String.IsNullOrEmpty(ObjCountry.Remarks) Then CountryRw.SetRemarksNull() Else CountryRw.Remarks = ObjCountry.Remarks End If CountryRw.Enabled = ObjCountry.Enabled Adapter.Update(CountriesTbl) End SubSub DeleteCountry(ByVal ObjCountry As Country) Adapter.Delete(ObjCountry.Country_ID)End Sub End Class
View Replies !
Object Reference Not Set To An Instance Of An Object (Inserting Data Into Database)
Each time I press submit to insert data into the database I receive the following message. I use the same code on another page and it works fine. Here is the error: Object reference not set to an instance of an object. 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.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 125: MyCommand.Parameters("@Balance").Value = txtBalance.Text Line 126: Line 127: MyCommand.Connection.Open() Line 128: Line 129: Try Source File: c:inetpubwwwrootCreditRepairCreditor_Default.aspx.vb Line: 127 Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] CreditRepair.CreditRepair.Vb.Creditor_Default.btnSaveAdd_Click(Object sender, EventArgs e) in c:inetpubwwwrootCreditRepairCreditor_Default.aspx.vb:127 System.Web.UI.WebControls.Button.OnClick(EventArgs e) System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) System.Web.UI.Page.ProcessRequestMain() Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click If (Page.IsValid) Then Dim DS As DataSet Dim MyCommand As SqlCommand Dim AddAccount As String = "insert into AccountDetails (Account_ID, Report_ID, Balance) values (@Account_ID, @Report_ID, @Balance)" MyCommand = New SqlCommand(AddAccount, MyConnection) MyCommand.Parameters.Add(New SqlParameter("@Account_ID", SqlDbType.Char, 50)) MyCommand.Parameters("@Account_ID").Value = txtAccount_ID.Text MyCommand.Parameters.Add(New SqlParameter("@Report_ID", SqlDbType.Char, 50)) MyCommand.Parameters("@Report_ID").Value = txtReport_ID.Text MyCommand.Parameters.Add(New SqlParameter("@Balance", SqlDbType.Char, 50)) MyCommand.Parameters("@Balance").Value = txtBalance.Text MyCommand.Connection.Open() MyCommand.ExecuteNonQuery() Response.Redirect("Customer_Details.aspx?SS='CustHeadGrid.Columns[0].Item.lblSS.Text)") MyCommand.Connection.Close() End If
View Replies !
Script Task Error --Object Reference Not Set To An Instance Of An Object
I am trying to execute this code feom Script task while excuting its giving me error that "Object reference not set to an instance of an object." The assemblies Iam referening in this code are there in GAC. Any idea abt this. Thanks, Public Sub Main() Dim remoteUri As String Dim fireAgain As Boolean Dim uriVarName As String Dim fileVarName As String Dim httpConnection As Microsoft.SqlServer.Dts.Runtime.HttpClientConnection Dim emptyBytes(0) As Byte Dim SessionID As String Dim CusAuth As CustomAuth Try ' Determine the correct variables to read for URI and filename uriVarName = "vsReportUri" fileVarName = "vsReportDownloadFilename" ' create SessionID for use with HD Custom authentication CusAuth = New CustomAuth(ASCIIEncoding.ASCII.GetBytes(Dts.Variables("in_vsBatchKey").Value.ToString())) Dts.Variables(uriVarName).Value = Dts.Variables(uriVarName).Value.ToString() + "&" + _ "BeginDate=" + Dts.Variables("in_vsBeginDate").Value.ToString() + "&" + _ "EndDate=" + Dts.Variables("in_vsEndDate").Value.ToString() Dim request As HttpWebRequest = CType(WebRequest.Create(Dts.Variables(uriVarName).Value.ToString()), HttpWebRequest) 'Set credentials based on the credentials found in the variables request.Credentials = New NetworkCredential(Dts.Variables("in_vsReportUsername").Value.ToString(), _ Dts.Variables("in_vsReportPassword").Value.ToString(), _ Dts.Variables("in_vsReportDomain").Value.ToString()) 'Place the custom authentication session ID in a cookie called BatchSession request.CookieContainer.Add(New Cookie("BatchSession", CusAuth.GenerateSession("EmailAlertingSSIS"), "/", Dts.Variables("in_vsReportDomain").Value.ToString())) ' Set some reasonable limits on resources used by this request request.MaximumAutomaticRedirections = 4 request.MaximumResponseHeadersLength = 4 ' Prepare to download, write messages indicating download start Dts.Events.FireInformation(0, String.Empty, String.Format("Downloading '{0}' from '{1}'", _ Dts.Variables(fileVarName).Value.ToString(), Dts.Variables(uriVarName).Value.ToString()), String.Empty, 0, fireAgain) Dts.Log(String.Format("Downloading '{0}' from '{1}'", Dts.Variables(fileVarName).Value.ToString(), Dts.Variables(uriVarName).Value.ToString()), 0, emptyBytes) ' Download data Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse) ' Get the stream associated with the response. Dim receiveStream As Stream = response.GetResponseStream() ' Pipes the stream to a higher level stream reader with the required encoding format. Dim readStream As New StreamReader(receiveStream, Encoding.UTF8) Dim fileStream As New StreamWriter(Dts.Variables(fileVarName).Value.ToString()) fileStream.Write(readStream.ReadToEnd()) fileStream.Flush() fileStream.Close() readStream.Close() fileStream.Dispose() readStream.Dispose() 'Download the file and report success Dts.TaskResult = Dts.Results.Success Catch ex As Exception ' post the error message we got back. Dts.Events.FireError(0, String.Empty, ex.Message, String.Empty, 0) Dts.TaskResult = Dts.Results.Failure End Try End Sub
View Replies !
Script Component Throws Object Reference Not Set To An Instance Of An Object
Hello, I've ran into trouble while creating a rather simple transformation script component (one input, one output). The only thing it has to do is test the values coming from it's input rows and set the values of the output rows according to some rules; something like: Code Block Public Overrides Sub InputBrowser_ProcessInputRow(ByVal Row As InputBrowserBuffer) If Row.UserAgent.Contains("MSIE") Then 'test input Row.BrowserName = "Internet Explorer" 'set output End If End Sub This raises an "Object reference not set to an instance of an object." exception. Commenting out the input (Row.UserAgent) solves the exception, but I actually do need to test the contents of the input row (and by leaving only the output manipulation, the script won't reach it's end, the components remain yellow). What can I do about this? Thanks in advance!
View Replies !
Report Server Issue Object Reference Not Set To An Instance Of An Object
Hi all, I'm getting this problem 'Object reference not set to an instance of an object.' whenever I try to review a report and I checked the log file and this is what it had w3wp!ui!1!11/14/2006-10:54:20:: Unhandled exception: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Reporting.WebForms.WebRequestHelper.GetExceptionForMoreInformationNode(XmlNode moreInfo, XmlNamespaceManager namespaces) at Microsoft.Reporting.WebForms.WebRequestHelper.ExceptionFromWebResponse(Exception e) at Microsoft.Reporting.WebForms.ServerReport.ServerUrlRequest(Boolean isAbortable, String url, Stream outputStream, String& mimeType, String& fileNameExtension) at Microsoft.Reporting.WebForms.ServerReport.GetStyleSheet(String styleSheetName) at Microsoft.Reporting.WebForms.ReportServerStyleSheetOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) at Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Some previous forums stated checking the webconfig file but the web config file look okay. Is there another way to fix this. Much Thanks, Carl
View Replies !
|