Scripting data to file...

TrikebTrikeb Posts: 13
edited October 11, 2007 12:51PM in SQL Toolkit Previous Versions
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,
Jonathan Comeau
Trikeb

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    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?
  • 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?
    Jonathan Comeau
    Trikeb
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    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.
  • I am having the same issue. How can I have the bundle 5?
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    SQL Data Compare 6 is out now. Can you try installing that and reference the components from there?
Sign In or Register to comment.