home · blog · groups · about us · contact us
DevelopmentNow Blog
 Wednesday, February 28, 2007
 
 

One of my projects involves a complex financial database (stored in Access). I wanted to add a feature to the client EXE that allowed testers to FTP their current copy of the database to me so that I could try to reproduce problems without having to reenter all the data. I didn't see an FTP control handy in VS2003, and I didn't feel like messing around with Windows built-in FTP command line program, which doesn't support passive mode & is annoying to pass parameters to.

So I found NcFTP, a free command line FTP program that fit the bill. Specifically, it offers a dedicated "uploader" program called NcFTPPut. Now, the codebehind for my "Upload Database" button looks like this

Private Sub UploadDatabase()
  If MessageBox.Show("Upload current database for testing? You must be connected to the internet.", _
      "Confirm Upload", MessageBoxButtons.YesNo) = DialogResult.Yes Then

    ' make temporary copy of database
    Dim currentDB As String = AppConfig.GetDBFileName
    Dim tmpDBName As String = currentDB.Replace(".mdb", "-" & _
      System.DateTime.Now.ToString("M-d-yyyy-h-m") & ".mdb")

    System.IO.File.Copy(currentDB, tmpDBName, True)

    ' upload using NcFTPPut
    Dim exe As String = System.IO.Path.GetDirectoryName(Application.ExecutablePath) & _
      "\ncftpput.exe"
    Dim params As String = "-u MyFTPUserName -p FTPPassword ftp.developmentnow.com . """ & tmpDBName & """"
    Try
      Dim myProcess As Process = System.Diagnostics.Process.Start(exe, params)

      myProcess.WaitForExit()

    Catch ex As Exception
      MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

    Finally
      ' delete temp copy
      System.IO.File.Delete(tmpDBName)
    End Try
  End If
End Sub

It's simple, but it works. Now whenever testers find problems with the program, they can just click the "Upload Database" button in my app to send me the data I need to reproduce the problem.

 

February 28, 2007    Bookmark to Digg or other social bookmarking
#    Disclaimer  |  Comments [0]

Related posts:
SubSonic DAL layers in Visual Studio
Intro to BDD
FireBug 1.0.1 is out
WYSIWYG editor in minutes
jQuery for javascript effects
Making a Basic Web Site on the Cheap


« Project Timer App | Main | Free/Cheap Software for Virtual Teams »
Comments are closed.