2013/01/25

DBF quick query tool

I created a simple tool for querying *.dbf files.

Two ways to query *.dbf:
1.Free table directory (No *.dbc) (OleDb)

Connection string will be like this:
Provider=vfpoledb;Data Source=C:\temp\WLAB32\;Collating Sequence=machine;

2.Database container (.DBC)

Connection string will be like this:
SourceDB=C:\YourPath\YourDbName.DBC;DRIVER={Microsoft Visual FoxPro Driver};SourceType=DBC;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes

You can download this tool from here.
You may need the VFPOLEDB driver (here)

Reference:
Connection strings for Visual FoxPro / FoxPro 2.x

2013/01/15

Allowing only digitals in textbox

private void textBox_KeyPress(object sender, KeyPressEventArgs e)
{
  if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
    e.Handled = true;
}

Reference: stackoverflow - How do I make a textbox that only accepts numbers?

2012/11/29

Delete a specific DataRow from the DataTable

DataTable dt = BusinessLogic.GetTable(sqlCmd);
dt.Rows.Remove(dt.Select("ColumnName1 = '12345' and ColumnName2 = '67890'")[0]);
dt.AcceptChanges();

2012/11/07

Blog uses new SyntaxHighlighter

I changed to use the latest SyntaxHighlighter recently and found that it causes many posts unreadable. If you found any post that you want to read is unreadable, please leave a message here. I will fix it ASAP.

2012/10/08

WebClient.DownloadString()

I just want to check a web content has something I want or not, so I use the WebClient.DownloadString() instead of using HttpWebRequest, HttpWebResponse, StreamReader... etc.
using (WebClient wclient = new WebClient())
{
    wclient.Encoding = Encoding.UTF8;   // change to fit your environment
    string content = wclient.DownloadString(url);
    result = content.Contains(keyword);
}