| 發文者 | someone |
| 日期 | 2008/11/5 上午 11:17:07 |
| 標題 | Re: 請問fortran可以直接讀Mdb |
| Message Id | BD47C301480241D5B6C836B1DB030BDB@c2q6600 |
| 內文 | 要讓fortran讀得懂Mdb之前必需作一些設定 建立程式與ODBC 連線 1.設定ODBC 2.用ODBC資料來源 3.設定Mdb資料管理員 完成了以上設定之後... 1.透過Window API呼叫Mdb資料 1)程序轉換C函式 !執行ODBC之SQL函式次序如下: integer function WinMain( hInstance, hPrevInstance, lpszCmdLine, nCmdShow ) !DEC$IF DEFINED(_X86_) !DEC$ ATTRIBUTES STDCALL, ALIAS : '_WinMain@16' :: WinMain !DEC$ELSE !DEC$ ATTRIBUTES STDCALL,ALIAS : 'WinMain' :: WinMain !DEC$ENDIF use dfwin use VFC_SQL integer hInstance integer hPrevInstance integer nCmdShow integer lpszCmdLine integer*4 hdbcl,henvl,hstmtl,iret character*265 comstr ! 與資料庫連接 iret = 0 call VFC_SQLAllocEnv(henvl,iret) if ( iret.lt.0 ) then stop endif call VFC_SQLAllocConnect(henvl,hdbcl,iret) if ( iret.lt.0 ) then stop endif call VFC_SQLConnect(hdbcl,"mdb"C,INT2(SQL_NTS),""C,INT2(0),""C,INT2(0),iret) if ( iret.lt.0 ) then stop endif call VFC_SQLAllocStmt(hdbcl,hstmtl,iret) if ( iret.lt.0 ) then stop endif ! 寫入Access comstr = "CREATE TABLE book1(NAME VARCHAR(20),Age INTEGER)" call VFC_SQLExecDirect(hstmtl,comstr,SQL_NTS,iret) comstr = "INSERT INTO book1 (NAME,Age) VALUES ('anything',26)"//char(0) call VFC_SQLExecDirect(hstmtl,comstr,SQL_NTS,iret) !中斷資料庫連接 call VFC_sqldisconn(hdbcl,henvl,hstmtl) WinMain = 0 end comstr = "CREATE TABLE book1(NAME TEXT,Age NUMBER)" call VFC_SQLExecDirect(hstmtl,comstr,SQL_NTS,iret) comstr = "INSERT INTO book1 (NAME,Age) VALUES (anything,26)"//char(0) call VFC_SQLExecDirect(hstmtl,comstr,SQL_NTS,iret) !中斷資料庫連接 call VFC_sqldisconn(hdbcl,henvl,hstmtl) WinMain = 0 end -- ASPNET News Reader http://tlcheng.twbbs.org/News/Reader.aspx RSS 2.0 http://tlcheng.twbbs.org/News/rss2.aspx?Action=List&Newsgroup=tw.bbs.comp.lang.fortran |
.Net 原始碼 | ASP.NET News Reader Beta 0.2.9
個人資料 |
發表新文章 |
回覆 |
回信 |
轉寄 |
同標題 | 搜尋
| 列印
預覽
直接
2007/06/21 由於微軟新聞伺服器移除多數新聞群組 (newsgroup),目前遭移除之群組暫時改為隱藏純瀏覽,若狀況已定案時,將會將隱藏中的群組重新調整。[討論]