Register / Warnings (me too please)

jbaggaleyjbaggaley Posts: 38
edited April 8, 2006 6:23AM in SQL Toolkit Previous Versions
Tom, you helped MarcL508 with an issue relating to testing sql compare on an automated application. I am running into exactly the same issue and would appreciate a similar hand....

As a future suggestion, perhaps the dll version of the toolkit can have a licence file and post to the event log every time it is used on a trial basis (until expiration). That way you still keep control of the buying process but it makes it much easier to test in a non-visual evnvironment.

Thanks

Jon
:-)zz[

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Jon,

    Thanks. It's a possibility. Although a big, fat BUY ME! flashing across the screen would no doubt be more desirable by our sales people.
  • Big fat Buy Me's are great (preferably with <BLINK>) if the application is giong to be working in a visual environment but more problematic outside that...

    I can prototype some parts of what we are trying to do with windows forms and some duplicated code but we can't performance test the approach to see if it the best way and works as expected without being non-visual. If we buy a license and then find it doesn't work as expected (because we can't try it non-visually) will we be able to get a refund? <grumble>lot of paperwork and purchasing trolls :twisted: ...</grumble>

    Better still, do you have full time limited (a couple of days should be enough) license keys available?

    Thanks

    Jon
    :-)zz[
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Jon,

    Can you please send me an email to support@red-gate.com? I'll then see if we can possibly provide you with a licence key. Since the only way around this issue is to give you a full licence and a solemn promise not to keep using it if you decide not to buy, I'll need to run it by some other people here first.

    Oh, the BLINK tag! One of Netscape's gems, I tell you.

    Thanks!
  • Hi Jon,

    Can you please send me an email to support@red-gate.com? I'll then see if we can possibly provide you with a licence key. Since the only way around this issue is to give you a full licence and a solemn promise not to keep using it if you decide not to buy, I'll need to run it by some other people here first.

    Oh, the BLINK tag! One of Netscape's gems, I tell you.

    Thanks!

    Brian,

    I have run into the same problem. I have purchased everything except for the ToolKit and now we in the process using the SQL compare and update using the Toolkit but before we buy we need to test non-visually if it works as expected. Since we have several database versions to be updated automatically. We need to know how this toolkit will work.

    I do have few questions about the toolkit.
    1. I need to update atleast 3-7 versions of databases. Each database version is different so I need to bring them to the latest. Let me know if I what i am planning to do will work with ToolKit.
    I need to create a pristine new DB using scripts(which I already have).
    I need to scan each attached DB and compare with new Pristine DB and update it.
    Also I need to save each compared database script from the Toolkit to a file. So, in case it wasn't able to update I can check file and resolve the problems.

    Please let me know if its possible to provide a license to test.

    Thanks
    Arun
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello Arun,

    Using Toolkit, you can make a 'snapshot' of your model database, deploy it to the site with your Toolkit application to compare and upgrade the database automatically. Using a combination of a deployment project with a custom task using Toolkit, you can upgrade any customer database, regardless of what version they're currently on.
  • Hello Arun,

    Using Toolkit, you can make a 'snapshot' of your model database, deploy it to the site with your Toolkit application to compare and upgrade the database automatically. Using a combination of a deployment project with a custom task using Toolkit, you can upgrade any customer database, regardless of what version they're currently on.

    Thanks for the reply.

    Can you send me a sample?
    How do I create a snapshot?

    if possible with a test license. I already convinced my boss to buy it but i need to make sure it works.

    Let me know
    Thanks
    Arun
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello Arun,

    Sorry I can't go too in-depth with this, but the basics are --
    • Start Visual Studio and create a new deployment project
    • Create a new project and add it to the current solution
    • Add a new Windows Installer class to the project and delete the class1.cs file
    • Override the installer's Install method.
    public override void Install&#40;System.Collections.IDictionary stateServer&#41; 
    		&#123;
    			//this.Install&#40;stateServer&#41;;
    			SyncDatabases&#40;this.Context.Parameters&#91;"DBServer"&#93;, this.Context.Parameters&#91;"DBName"&#93;,this.Context.Parameters&#91;"DB1Snapshot"&#93;&#41;;
    		&#125;
    
    • Create the new SyncDatabases method and paste the Toolkit example code to comapre databases inside:
    protected void SyncDatabases&#40;string DBServer, string DBName, string DB1Snapshot&#41; &#123;&#125;
    
    • Change the SQL Compare code snippet to load database 1 from snapshot:db1.LoadFromDisk(DB1Snapshot);
    • Right-click the deployment project and select Add->Project output. Add the project output from the project you'd created.
    • Go into the deployment project and select View->UI and right-click Start and add dialog. Enable two textboxes: Database Server and Database Name
    • Run SQL Compare UI, go to file->create snapshot and create a SNP file of the model database. Copy this file somewhere into your deployment project.
    • In the deployment project, right-click it and do view->file system. In the installation folder, add your SNP file.
    • Right-click the deployment project again and do view->Custom actions
    • right-click install and add...
    • Choose application folder and then 'primary output from (your project)'
    • Right click the new custom action and view the properties
    • Custom action data should look like this: /DBServer=[DBSERVER] /DBName=[DBNAME] /DB1Snapshot=[AppFolder]MyFile.snp where DBSERVER and DBNAME are the variables you'd assigned in the User Interface and MyFile is your snapshot.
    When this is compiled and run, the snapshot file is copied to the local machine using Windows Installer and then the .NET code is run to script a database upgrade. Additionally you may want to create a second project to actually create the database and put that in as a similar custom action higher in the order.
    [*]
  • Hello Arun,

    Sorry I can't go too in-depth with this, but the basics are --
    • Start Visual Studio and create a new deployment project
    • Create a new project and add it to the current solution
    • Add a new Windows Installer class to the project and delete the class1.cs file
    • Override the installer's Install method.
    public override void Install&#40;System.Collections.IDictionary stateServer&#41; 
    		&#123;
    			//this.Install&#40;stateServer&#41;;
    			SyncDatabases&#40;this.Context.Parameters&#91;"DBServer"&#93;, this.Context.Parameters&#91;"DBName"&#93;,this.Context.Parameters&#91;"DB1Snapshot"&#93;&#41;;
    		&#125;
    
    • Create the new SyncDatabases method and paste the Toolkit example code to comapre databases inside:
    protected void SyncDatabases&#40;string DBServer, string DBName, string DB1Snapshot&#41; &#123;&#125;
    
    • Change the SQL Compare code snippet to load database 1 from snapshot:db1.LoadFromDisk(DB1Snapshot);
    • Right-click the deployment project and select Add->Project output. Add the project output from the project you'd created.
    • Go into the deployment project and select View->UI and right-click Start and add dialog. Enable two textboxes: Database Server and Database Name
    • Run SQL Compare UI, go to file->create snapshot and create a SNP file of the model database. Copy this file somewhere into your deployment project.
    • In the deployment project, right-click it and do view->file system. In the installation folder, add your SNP file.
    • Right-click the deployment project again and do view->Custom actions
    • right-click install and add...
    • Choose application folder and then 'primary output from (your project)'
    • Right click the new custom action and view the properties
    • Custom action data should look like this: /DBServer=[DBSERVER] /DBName=[DBNAME] /DB1Snapshot=[AppFolder]MyFile.snp where DBSERVER and DBNAME are the variables you'd assigned in the User Interface and MyFile is your snapshot.
    When this is compiled and run, the snapshot file is copied to the local machine using Windows Installer and then the .NET code is run to script a database upgrade. Additionally you may want to create a second project to actually create the database and put that in as a similar custom action higher in the order.
    [*]

    Thanks for the code. I will try it and let you know if i encounter any problem.
    I have another question, I would like to know How I can execute a SQL script file. Let me explain.
    1. I have 3 SQL Script files
    b. CreateTables.sql
    c. CreateViewsStoredProc.sql

    My question is how do i execute an external script file on a selected database.
    here's the code i use
    RedGate.SQLCompare.Engine.Database db1 = new RedGate.SQLCompare.Engine.Database();

    db1.Register(new ConnectionProperties(".", DBName), Options.Default);

    I need to run the above scripts on this database.
    do I use
    Work wrk = new Work();
    wrk.ExecutionBlock.AddBatch(scriptfile);

    Please let me know.

    Thanks
    Arun
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Arun,

    It's probably not a good idea to mess with the execution block. What I've found works best is to use .NET's SQLCLIENT to run your own SQL using a SqlConnection and SqlCommand object, and executing the SQL using the SqlCommand.ExecuteNonQuery method.
Sign In or Register to comment.