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 IfEnd 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.
Powered by: newtelligence dasBlog 2.0.7226.0
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2008, Ben Strackany
E-mail