Tuesday, March 30, 2010
Reading DBF files from .NET
There was no much time, so I decided to do that in c# using ODBC.net data provider. This post shows one way of loading DBF table in DataTable object.
System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection();
//short connection string ( but works )
conn.ConnectionString = @"DSN=dBase Files";
conn.Open();
System.Data.Odbc.OdbcCommand comm = new System.Data.Odbc.OdbcCommand();
comm.CommandText = "SELECT * FROM c:\\folder\\fileName.dbf" ;
comm.Connection = conn;
DataTable dt = new DataTable();
dt.Load(comm.ExecuteReader());
conn.Close();
//after this you cab do what you want with the data table
Windows 2000 Professional and Windows 2000 Server are approaching 10 years since their launch and both products will go out of support on July 13, 2010.
Windows XP was launched back in 2001. While support for the product will continue, Service Pack 2 will go out of support on July 13, 2010. From that date onwards, Microsoft will no longer support or provide free security updates for Windows XP SP2. Please install the free Service Pack 3 for Windows XP to have the most secure and supported Windows XP platform.
Finally, Windows Vista with no Service Packs installed will end support on April 13 2010. Please install the free Service Pack 2 for Windows Vista to have the most secure and supported Windows Vista platform.
Wednesday, December 9, 2009
Developer showcase and contest
The Developer Platform Marketing team has launched a compelling new worldwide Microsoft® .NET Framework campaign at www.dotnetstories.com.
Through online videos and written case studies featuring real developers who built amazing and diverse solutions on the .NET Framework, the campaign is intended to tell a clean and cohesive end-to-end story that is engaging and relevant to the developer community.
GET INTO .NET CHALLENGE at www.mydotnetstory.com
for a chance to win a 12-day Galapagos Islands trip or a Smart Car!
Upload your solution before 31.12.2009
Thursday, May 14, 2009
Unlocking application files (running from cached location)
Month or two ago, I was working on project for automatic installation and upgrade of windows forms application. In preparation for the project, I was trying to modify component (dll file) on which application depends. Result from those attempts was inconsistent, When I had tryed to modify component which I had already used in my application, modification fails, but when component was unused, modification succeeded.
That was not enough for me, because requirements ask for possibility of upgrading the files at any time.
First idea was, to download new file in some subfolder and when application exits, override the application or component file. Searching the msdn for better solution, I found way to load and run application from cached folder, here is the example of Main method which I had incorporated in the solution:
static void Main(string [] args)
{
// Aplication name ( from command line )
string appName=args[0];
// Get the startup path.
string startupPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
// cache path = directory where the assemblies get
// shadow copied
string cachePath = Path.Combine(startupPath,"cachedFiles");
string configFile = Path.Combine(startupPath,appName+".config");
string assembly = Path.Combine(startupPath,appName);
// Create the setup for the new domain
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationName = appName;setup.ShadowCopyFiles = "true";
// it isn't a bool it's a string,
// developer team decide to leave that inconsistent API for
//backward compatibility
setup.CachePath = cachePath;
setup.ConfigurationFile = configFile;
// Create the application domain with same evidence
AppDomain domain =
AppDomain.CreateDomain(appName,AppDomain.CurrentDomain.Evidence,setup);
// Start appName application by executing the assembly
domain.ExecuteAssembly(assembly);
// After the application has finished clean up
AppDomain.Unload(domain);
Directory.Delete(cachePath, true);
}