Scripting data to file...

Forum for users of SQL Toolkit 3,4,and 5

Scripting data to file...

Postby Trikeb » Wed Sep 05, 2007 4:56 pm

Hi,

I'm trying to script the data to a SQL script file using the following code...

database = New RedGate.SQLCompare.Engine.Database
database.RegisterForDataCompare(New RedGate.SQLCompare.Engine.ConnectionProperties(serverName, databaseName, "sa", "sa"), Options.Default)

Dim mappings As New SchemaMappings
mappings.CreateMappings(database, Nothing)

Dim session As New ComparisonSession()
session.CompareDatabases(database, Nothing, mappings)

Dim provider As New SqlProvider
Dim m_DataBlock = provider.GetMigrationSQL(session, False)

blocksaver.FileName = "c:\\data.sql"
blocksaver.EncodingType = EncodingType.UTF8
blocksaver.ExecutionBlock = m_DataBlock

blocksaver.SaveToFile()


I get the following error:

Method not found: 'Void RedGate.SQLCompare.Engine.Mappings.CreateMappings(RedGate.SQLCompare.Engine.SerializableCollection, RedGate.SQLCompare.Engine.SerializableCollection, Boolean)'

What is the proper way to accomplish what I want? (Which is to script the entire data of my database to a *.sql file in order to use it later on to synchronize the content of a client database with the generated script.)

Thanks in advance,
Trikeb
 
Posts: 9
Joined: Tue Aug 28, 2007 8:10 pm
Location: Montreal (Canada)

Postby Brian Donahue » Thu Sep 06, 2007 9:51 am

Off the top of my head, I'd say this happened because CreateMappings will only accept a collection of tables or views as arguments, ie mappings.CreateMappings(database.Tables, Nothing). The particular overload that appears in the error message isn't documented in the Toolkit help, though. It must be a private method?
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby Trikeb » Thu Sep 06, 2007 4:26 pm

Hi Brian,

I've tried replacing my schema mapping object by a table mapping object like this:

database = New RedGate.SQLCompare.Engine.Database
database.RegisterForDataCompare(New RedGate.SQLCompare.Engine.ConnectionProperties(serverName, databaseName, "sa", "enteractives.ca"), Options.Default)

Dim mappings As New TableMappings
mappings.CreateMappings(database.Tables, Nothing)


With the same result. The RegisterForDataCompare() executes without problems but the CreateMappings() method raises the same exeption.
I guess my answer can be found here: http://www.red-gate.com/messageboard/vi ... php?t=5438

I'm currently evaluating the SQLToolkit v6... when can I expect this functionality to be implemented?
If it is only available in v5 of the Toolkit, how can I obtain a copy of it?
Trikeb
 
Posts: 9
Joined: Tue Aug 28, 2007 8:10 pm
Location: Montreal (Canada)

Postby Brian Donahue » Tue Sep 11, 2007 3:29 pm

Sorry, I didn't realize that you couldn't mix the SQL Compare Engine from version 6 and the data compare engine from version 5. SQL Data Compare 6 will be released next month (which should solve the issue), but in the meantime, I'll private message you with the likk to SQL Bundle 5.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby mackmak » Thu Oct 11, 2007 2:50 pm

I am having the same issue. How can I have the bundle 5?
mackmak
 
Posts: 3
Joined: Thu Oct 11, 2007 1:42 pm

Postby Brian Donahue » Thu Oct 11, 2007 5:51 pm

SQL Data Compare 6 is out now. Can you try installing that and reference the components from there?
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am


Return to SQL Toolkit Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests