错误:对象引用未设置为对象的实例。谁能帮我?

时间:2015-04-15 15:45:10

标签: c# postgresql

 private void Cust_Load(object sender, EventArgs e)
 {
     ds = new DataSet();

     conn = new OdbcConnection();
     conn.ConnectionString = "Dsn=PostgreSQL30;database=postgres;server=localhost;port=5432;uid=postgres;sslmode=disable;readonly=0;protocol=7.4;fakeoidindex=0;showoidcolumn=0;rowversioning=0;showsystemtables=0;fetch=100;socket=4096;unknownsizes=0;maxvarcharsize=255;maxlongvarcharsize=8190;debug=0;commlog=0;optimizer=0;ksqo=1;usedeclarefetch=0;textaslongvarchar=1;unknownsaslongvarchar=0;boolsaschar=1;parse=0;cancelasfreestmt=0;extrasystableprefixes=dd_;lfconversion=1;updatablecursors=1;disallowpremature=0;trueisminus1=0;bi=0;byteaaslongvarbinary=0;useserversideprepare=0;lowercaseidentifier=0;gssauthusegss=0;xaopt=1;pwd=postgres";
     OdbcDataAdapter da = new OdbcDataAdapter("select * from cust", conn);
     OdbcCommandBuilder cmdBld = new OdbcCommandBuilder(da);
     da.Fill(ds, "cust");
     grdCust.DataSource = ds;
     grdCust.DataMember = "cust";
}

private void btnSave_Click(object sender, EventArgs e)
{       
    da.Update(ds,"cust**strong text**");
}

0 个答案:

没有答案