Error while registering database using API

rmajumdarrmajumdar Posts: 2
edited October 29, 2008 9:21AM in SQL Compare Previous Versions
Hi,

I am trying to compare a live database and a script folder using SQLComapre 7 API. It was working for first few days, but it is suddenly failing with the following error message when I am trying to register the database that represents the scripts folder.

'An item with the same key has already been added.' at

scriptFolderDatabase.Register(parameter.InputFolderPath, dbInfo, databaseOptions)

the full code is :

Options databaseOptions = Options.Default | Options.IgnoreCollations | Options.IgnoreFileGroups | Options.IgnoreFillFactor |
Options.IgnoreWhiteSpace | Options.IgnoreQuotedIdentifiersAndAnsiNullSettings;

Database emptyDatabase = new Database();
emptyDatabase.Register(parameter.ToRedGateConnectionProperty(), databaseOptions);

Database scriptFolderDatabase = new Database();
ReadFromScriptDatabaseInformation dbInfo = new ReadFromScriptDatabaseInformation();
dbInfo.DefaultCollation = "SQL_Latin1_General_CP1_CI_AS";
dbInfo.DefaultOwner = "dbo";
scriptFolderDatabase.Register(parameter.InputFolderPath, dbInfo, databaseOptions);


the stack trace is:

at RedGate.SQLCompare.Rewriter.Analysis.Analyser`1.WaitForBackgroundThread()
at cV.a(FileInfo )
at cV.a()
at RedGate.SQLCompare.Engine.Database.Register(String path, ReadFromScriptDatabaseInformation dbinfo, Options options)
at PwC.Audition.Tools.SQLCompareWrapper.SchemaScriptGenerator.GenerateSchemaScript(SchemaScriptGeneratorParameter parameter) in D:\CAR_Audition\Tools\PwC.Audition.Tools.SQLCompareWrapper\SchemaScriptGenerator.cs:line 33


Can anyone please help with that?

Comments

  • Thanks for your post.

    It might be a good idea to try troubleshooting this using the SQL Compare 7 UI. It has a logging feature that should at least show which object is causing the problem; and it might also give you a better error message during comparison.

    If you are happy to try the UI, you can enable logging by selecting the SQL Compare logo on the title bar, and then 'Enable Logging >> Verbose'

    If this doesn't help, please can you send any logs, a snapshot of the live database, and a copy of the scripts folder to support@red-gate.com and we can try and recreate the problem here.
    Chris
Sign In or Register to comment.