在Microsoft Visual Studio 2008的webform里调试通过.
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.Odbc;
using System.Xml.Linq;public partial class _Default : System.Web.UI.Page 
{
    OdbcConnection conn = new OdbcConnection();
    string connStr = @"Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=F:\";     protected void Page_Load(object sender, EventArgs e)
    {    }
    protected void Button1_Click(object sender, EventArgs e)
    {        //string table = @"F:\test.dbc";        conn.ConnectionString = connStr;
        conn.Open();
        //OdbcCommand cmd = new OdbcCommand();
        //cmd.Connection = conn;
        //string sql = "update " + table + " set other='2',rate=1.014 ";
        //cmd.CommandText = sql;
        //cmd.CommandType = CommandType.Text;
        //cmd.ExecuteNonQuery();        string sql = @"SELECT * FROM JHD WHERE (SUBST(BH, 1, 2) = '02')";
        OdbcDataAdapter da = new OdbcDataAdapter(sql, conn);
        DataTable dt = new DataTable();
        da.Fill(dt);
        this.GridView1.DataSource = dt.DefaultView;
        this.GridView1.DataBind();
        conn.Close();    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        conn.ConnectionString = connStr;
        conn.Open();
        
        OdbcCommand cmd = new OdbcCommand();
        cmd.Connection = conn;
        string sql = @"INSERT INTO jhd  (dh,bh, mc) VALUES ('t01','0251', 'tmc') ";
        cmd.CommandText = sql;
        cmd.CommandType = CommandType.Text;
        cmd.ExecuteNonQuery();        conn.Close();    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        conn.ConnectionString = connStr;
        conn.Open();        OdbcCommand cmd = new OdbcCommand();
        cmd.Connection = conn;
        string sql = @"DELETE FROM jhd where dh='t01'";
        cmd.CommandText = sql;
        cmd.CommandType = CommandType.Text;
        cmd.ExecuteNonQuery();        conn.Close();    }
}
[i][/i]