CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2005
    Location
    San Antonio Tx
    Posts
    44

    win batch file that uploads mysql data

    i wasn't sure where to put this thread so please redirect me if im in the wrong forum.

    i have a batch file that uploads a data.sql script to a mysql server and its working fine, i have this command:

    Code:
    mysql -u [username] -p[pass] -h [host] [db_name] < data.sql
    this works fine but i want add the ability to write to a log whenever this batch file executes successfully or if there is an error

    basically i want to be able to do something like this:

    Code:
    mysql -u [username] -p[pass] -h [host] [db_name] < data.sql
    
    *sudocode*
    if mysql command ok
       echo "command executed successfully >> log.txt
    else if mysql command returned error
       echo "there was an error the command did not executed" >> log txt
    so my question boils down to, am I taking the right approach? and if so how can i read or interpret the responses from the shell within a batch file? is that possible or should I consider more powerful languages for this type of scripts like c++ or java?

    thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: win batch file that uploads mysql data

    Take a look at POWERSHELL 2.0. It's FREE, and uses .Net to replace the old DOS BATCH FILE structure. You can make a progress bar with a few ****'s
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured