Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

使用OdbcDataAdapt 存取 free dbf table

103 views
Skip to first unread message

Arthur

unread,
Sep 13, 2006, 5:36:01 AM9/13/06
to
有 visual foxpro 6.0 建立的 free dbf table
想由 WebService 使得遠端可以讀取及更新
一開始拉出 OdbcDataAdapt, 設定連接, 載入資料
在載入資料時, 執行查詢都可以看的到資料
最後由 DataAdapt 產生資料集(Dataset)

程式中
先 Imports Namespcae
再宣告WebMethod 的函數
在函數有 執行 OdbcDataAdapt.fill(ds1)
再把 Return ds1

再來是 建置方案
沒問題之後, 測試 run 看看
可以看到網頁上有剛宣告的函名稱
點了之後在下一頁選 "叫用"
出現
System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC 驅動程式管理員]
找不到資料來源名稱且未指定預設的驅動程式

請問該如何解決?
謝謝

註:1.確定ODBC 驅動程式設定沒錯, 也存在
2.以下是程式
<WebMethod()> _
Public Function Test() As DS
Me.odbcDataAdapter1.Fill(ds1)
Return ds1
End Function

璉璉

unread,
Sep 13, 2006, 11:25:04 AM9/13/06
to
沒看到你指定資料來源的連線字串,只看到 Fill 沒啥用。

==> 本文由 "Arthur <Art...@discussions.microsoft.com>"
> 於 news:E4052DF0-F741-40ED-B9B1-E7A31695181B%40microsoft.com 發表

--
風禹科技驗證有限公司 ASP.NET Web News Reader 0.2.3 UTF-8 Beta
網站地圖 http://tlcheng.twbbs.org/wwwmap.htm
流域防洪/區域水資源/徐昇網/玫瑰圖/語音通訊 文章與程式
Basic/Fortran/Windows API/.Net/輔助說明檔 原始碼、文章與討論
微軟程式設計新討論區 MSDN 技術論壇,網友回覆後即時簡訊、電子郵件通知:
http://forums.microsoft.com/msdn-cht/default.aspx?siteid=14
--
ASPNET News Reader http://tlcheng.twbbs.org/News/Reader.aspx
RSS 2.0 http://tlcheng.twbbs.org/News/rss2.aspx?Action=List&Newsgroup=microsoft.public.tw.dotnet.framework.webservices

Arthur

unread,
Sep 13, 2006, 9:24:02 PM9/13/06
to
基本上OdbcDataAdapt 是用元件拉出來的, 不是自己下的字串, 應該沒有問題
ConnectionString =
"Dsn=VFPTble;sourcedb=d:\PROJS\TestWebSerservice\Data;sourcetype=DBF;exclusive=No;backgroundfetch=Yes;collate=Machine"

謝謝回覆

"璉璉" 來函:

> 沒看到你指定資料來源的連線字串,只看到 Fill 沒啥用。

璉璉

unread,
Sep 14, 2006, 10:09:59 AM9/14/06
to
你的錯誤訊息是:

System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC 驅動程式管理員]
找不到資料來源名稱且未指定預設的驅動程式

所以請確認你的 系統管理工具 資料來源 有 VFPTble 這個名稱。

你也可以直接自己組連線字串,例如:
Driver={Microsoft Visual FoxPro Driver}; DBQ=d:\PROJS\TestWebSerservice\Data; ...

另外請確認這個目錄有提供寫入權給執行 Web Service 帳號的權限。

==> 本文由 "Arthur <Art...@discussions.microsoft.com>"
> 於 news:7323D32B-42E2-43A6-BB8A-C16C5DC66385%40microsoft.com 發表

--

璉璉

unread,
Sep 14, 2006, 10:13:38 AM9/14/06
to
你還可以參考這個網站 ODBC 連線字串的範例:
http://www.connectionstrings.com/

Database container (.DBC):
"Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=c:\myvfpdb.dbc;Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO"

Free Table directory:
"Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=c:\myvfpdbfolder;Exclusive=No;Collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO"


"Collate=Machine" is the default setting, for other settings check the list of supported collating sequences >>

==> 本文由 "璉璉 <de...@tainan.com.tw>"
> 於 news:000d01c6d807%2476a84df0%240a03a8c0%40tlcheng 發表

0 new messages