Red Gate forums :: View topic - [Need Help]Compare encrypted functions doesn't work
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Comparison SDK Previous Versions
SQL Comparison SDK Previous Versions forum

[Need Help]Compare encrypted functions doesn't work

Search in SQL Comparison SDK Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
kevinlan



Joined: 02 Nov 2011
Posts: 9

PostPosted: Wed Nov 02, 2011 2:30 pm    Post subject: [Need Help]Compare encrypted functions doesn't work Reply with quote

Error Message :Index was outside the bounds of the array.


System.IndexOutOfRangeException was unhandled
Message="Index was outside the bounds of the array."
Source="RedGate.BackupReader"
StackTrace:
at bV.GetPage(cG pfid, Byte[] targetArray)
at di.<GetHobtRowsFromIAM>d__0.MoveNext()
at di.<GetTableRowsFromIAM>d__e.MoveNext()
at bH.a(String A_1, IEnumerable`1 A_2, IEnumerable`1 A_3)
at bH.PopulateTable(ITableName name, bU pageProvider, bz schemaProvider, aJ tracker)
at RedGate.BackupReader.LiveConnection.PopulateAdditionalSystemTables(List`1 tables)
at RedGate.BackupReader.LiveConnection.PopulateAdditionalSystemTables(ITableName[] tables)
at N..ctor(SqlConnection conn, SQLVersion version)
at w.RedGate.SQLCompare.Engine.IDatabaseHelper.GetEncryptedText(r resultSet, Int32 objectID)
at p.a(o A_1, Boolean A_2)
at p.a(o A_1)
at RedGate.SQLCompare.Engine.Database.Register(ConnectionProperties connectionProperties, Options options)
at Tools.SqlCompareReport.SqlCompareReport.RunCompareRport(Int32 RID, String SourceServer, String SourceDB, String DesServer, String DesDB) in C:\Documents and Settings\user\My Documents\Visual Studio 2008\Projects\DataBaseTools\SqlCompareReport\SqlCompareReport.cs:line 39
at SqlCompareReport.Program.Main(String[] args) in C:\Documents and Settings\Klan\My Documents\Visual Studio 2008\Projects\DataBaseTools\SqlCompareReport\Program.cs:line 25
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:



Hi Guys ,i am so lost in this error message .Could someone could help me

when call the register function to Register the database, it raise this error all the same.if there hasn't Encrypted objects, it can work well.


DALCompareReport logreport = new DALCompareReport();
string DifferentType = string.Empty;
string FileName = string.Empty;
Options myoptions = Options.Default | Options.DecryptPost2kEncryptedObjects | Options.IgnorePermissions | Options.IgnoreWhiteSpace | Options.IgnoreUsers;


public void RunCompareRport(int RID,string SourceServer, string SourceDB, string DesServer, string DesDB)
{
using (Database stagingDB = new Database(), productionDB = new Database())
{
//ConnectionProperties sourceConnectionProperties = new ConnectionProperties(Program.StagingServerName, Program.StagingDatabaseName);
// ConnectionProperties targetConnectionProperties = new ConnectionProperties(Program.ProductionServerName, Program.ProductionDatabaseName);

ConnectionProperties sourceConnectionProperties = new ConnectionProperties(SourceServer, SourceDB);
ConnectionProperties targetConnectionProperties = new ConnectionProperties(DesServer, DesDB);

// Connect to the two databases and read the schema
try
{
Console.WriteLine("Registering database " + targetConnectionProperties.DatabaseName + " on server " + DesServer);


productionDB.Register(targetConnectionProperties,myoptions); --error happen in this line
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1123
Location: My desk.

PostPosted: Thu Nov 03, 2011 7:08 pm    Post subject: Reply with quote

Thanks for your post, and sorry you're having some trouble.

If you have encrypted objects, then you need to ensure the backupreader DLL is included in your solution. In addition, you must compile specifically for "X86" rather than "AnyCPU".

Once you've checked that, if the problem persists, can you let us know:

- does the same thing happen in the SQL Compare GUI?
- what version of the Compare DLL are you using in your solution?
Back to top
View user's profile Send private message
kevinlan



Joined: 02 Nov 2011
Posts: 9

PostPosted: Fri Nov 04, 2011 4:01 am    Post subject: Reply with quote

Hi, i found this error only raise when the target server is X64, it would be ok if the trarget db server is X32 bit.

i have included the backupreader.dll and compiled my project as x86

there hasn't any problem when used the Sql Compare GUI.

i am using the Sql Comparision SDK 8.0

thanks
Back to top
View user's profile Send private message
kevinlan



Joined: 02 Nov 2011
Posts: 9

PostPosted: Fri Nov 04, 2011 4:30 am    Post subject: Reply with quote

the issue i came cross is similar with this one


https://www.red-gate.com/supportcenter/Content?c=knowledgebase%5cSQL_Compare%5cKB200810000309.htm&p=SQL%20Compare


thanks
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1123
Location: My desk.

PostPosted: Fri Nov 04, 2011 9:15 am    Post subject: Reply with quote

Did compiling for 32-bit fix it? The BackupReader component (required for encryption) is 32-bit only which is why you need to do this.

If the problem persists, you may have an older DLL but I thought v8 should be ok. Check the version number of the actual DLL you are referencing.
Back to top
View user's profile Send private message
kevinlan



Joined: 02 Nov 2011
Posts: 9

PostPosted: Fri Nov 04, 2011 9:32 am    Post subject: Reply with quote

Hi james:
thanks for you reply

i haven't fixed it .

your means that i compile my project with X86? i did it.

the backupreader version is 1.3.0.106

thanks
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1123
Location: My desk.

PostPosted: Fri Nov 04, 2011 9:35 am    Post subject: Reply with quote

Can you try installing SQL Compare using this link and then reference all the DLLs in "C:\Program Files (x86)\Red Gate\SQL Compare 8" instead of the ones in the SDK folder?
Back to top
View user's profile Send private message
kevinlan



Joined: 02 Nov 2011
Posts: 9

PostPosted: Mon Nov 07, 2011 6:48 am    Post subject: Reply with quote

Hi james, it can works by using the sql compare 8.5 version.

but i am a liittle confuse that why this error happened on the sdk 8.1,
it can works when i was using the Compare 8.1 UI .


thanks
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1123
Location: My desk.

PostPosted: Mon Nov 07, 2011 12:46 pm    Post subject: Reply with quote

If you were using the 8.1 DLLs these may be different to the ones in 8.1 of Compare (there are "sub-versions"). Or it may have been a problem just accessing the DLLs via your own code rather than how Compare uses them internally. If it's good with the newer ones though, that's great.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group