Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2007
    Posts
    15

    Create Database, Attach Database Whatever works

    Ok,

    This should be a fairly simple task I would think. SQL Express gets installed. Next step is to create a database, either using a sql script or by attaching an already existing database. Either way, you would think File.Run using sqlcmd would do the trick. But for the life of me, I cannot figure out how to get this to work. If anyone has done this and has an example, or a tried and true method to get this done, would you please share it.

    Thanks
    And now, adding color, a group of anonymous Latin-American Meat packing glitterati.

  2. #2
    Join Date
    Apr 2007
    Posts
    15
    Let me expand on that a bit. I use the following command in the "On Post Install" section:

    File.Run("sqlcmd", " -S .\\SQLEXPRESS -U sa -P sql -o C:\sqlout.txt -i "..strLoc.."\\BatchFieldLayout.sql", "", SW_HIDE, true);

    I have about 15 of those, all the same except for the file. The first time I run the install, it installs SQL Express just fine, but errors on the File.Run commands with error 1013 - File Execution Failed. However, if I run the install again right after that, it will skip the SQL Express setup, but the commands execute just fine. SQL Express is installed with the following command line:

    File.Run(strTempFolder.."\\MSSQLSERVER\\SQLEXPR.ex e", " /qb ADDLOCAL=ALL AGTAUTOSTART=1 DISABLENETWORKPROTOCOLS=0 USERNAME=Smartlinc COMPANYNAME=Smartlinc SECURITYMODE=SQL SAPWD=sql", "", SW_SHOWNORMAL, true);

    I have checked after the SQL Express install, but before continuing on with the rest of the install, and all the services are running correctly for SQL Express. I'm at a loss as to why this would happen. Has anyone run into this before?
    And now, adding color, a group of anonymous Latin-American Meat packing glitterati.

  3. #3
    Join Date
    Jan 2002
    Location
    Nashville TN
    Posts
    328
    First thing I noticed is that C:\ is missing the double "\\" so that will cause you a problem. Also might try putting in a working directory, and also giving the full path to sqlcmd might help.

    File.Run("sqlcmd", " -S .\\SQLEXPRESS -U sa -P sql -o C:\sqlout.txt -i "..strLoc.."\\BatchFieldLayout.sql", "", SW_HIDE, true);
    File.Run("sqlcmd", " -S .\\SQLEXPRESS -U sa -P sql -o C:\\sqlout.txt -i "..strLoc.."\\BatchFieldLayout.sql", "", SW_HIDE, true);
    C:\\

  4. #4
    Join Date
    Apr 2007
    Posts
    15
    Didnt notice the \\, will try the full path, and what exactly will a working directory do? The thing that bothers me most is that if I run the install again the commands execute just fine.
    And now, adding color, a group of anonymous Latin-American Meat packing glitterati.

  5. #5
    Join Date
    Jan 2002
    Location
    Nashville TN
    Posts
    328
    Working directory is like the old DOS path command, it gives the program a location to look for its base files, and required sub files, its not always needed, but if your having isses (As I had just a few weeks ago) making that adjustment might just work.

  6. #6
    Join Date
    Apr 2007
    Posts
    15
    Got it working, put the full path to the sqlcmd in there and that did it. Thanks for the help Jason.
    And now, adding color, a group of anonymous Latin-American Meat packing glitterati.

Similar Threads

  1. SQLite database in MEMORY only!
    By Intrigued in forum AutoPlay Media Studio 5.0
    Replies: 5
    Last Post: 10-23-2009, 07:49 PM
  2. How to convert access database to sqlite database.
    By sside in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 07-22-2008, 07:44 PM
  3. Attach the desired database
    By code83z in forum Setup Factory 7.0
    Replies: 0
    Last Post: 03-11-2007, 03:24 AM
  4. HOWTO: Create a Project Template
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-28-2002, 01:49 PM
  5. HOWTO: Create a Page Template
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-26-2002, 05:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts