一直在用招行的網(wǎng)上銀行專業(yè)版,但是其中的投資管理中不能計(jì)算一支股票買賣之后的盈虧,于是只有自己動(dòng)手寫一個(gè)
通過其中的歷史查詢頁面把數(shù)據(jù)復(fù)制到excel中,然后用c#讀取進(jìn)入數(shù)據(jù)庫
下面這個(gè)是先讀到dataset中,先滿足我初步的計(jì)算,后面的工作慢慢晚上,爭取這個(gè)寒假搞定
string str = "provider=microsoft.jet.oledb.4.0;data source=e:/test.xls;extended properties=/"excel 8.0;hdr=yes;imex=1;/" ";
dataset ds=new dataset();
private void form1_load(object sender, eventargs e)
...{
oledbconnection con;
oledbdataadapter myadapter;
con = new oledbconnection(str);
try
...{
con.open();
myadapter = new oledbdataadapter("select * from [sheet1$]", con);
myadapter.fill(ds, "ds");
datagridview1.datasource = ds.tables["ds"];
}
catch (exception ex)
...{
throw new exception(ex.message);
}
finally ...{
con.close();
}
新聞熱點(diǎn)
疑難解答
圖片精選