pb 里連接sql server 資料庫,雙擊運行系統時連接資料庫正常,但是我在注冊表自動運行時就連接不上資料庫,sqlcode=-1 sqltext='登錄不正確' 請問我應該如何解結????謝謝
uj5u.com熱心網友回復:
有幾種可能:1. 操作資料庫的'用戶',未設定好
2. 訪問資料庫方式選擇'SQL Server 和 Windows',試試看.....
uj5u.com熱心網友回復:
好像沒能解決問題,能否還有什么辦法??最好是自已先試一下uj5u.com熱心網友回復:
自運行時,確認網路是否已經正常連接。uj5u.com熱心網友回復:
給你一段代碼:String ls_ini, ls_section
//***** 資料庫引數設定、連接資料庫(sqlca)
ls_ini = 'njxmq_his.ini'
ls_section = 'njxmqhisdatabase'
SQLCA.DBMS = ProfileString(ls_ini,ls_section,"DBMS", " ")
SQLCA.Database = ProfileString(ls_ini,ls_section,"DataBase", " ")
SQLCA.LogID = ProfileString(ls_ini,ls_section,"LogID", " ")
SQLCA.LogPass = ProfileString(ls_ini,ls_section,"LogPassword", " ")
SQLCA.ServerName = ProfileString(ls_ini,ls_section,"ServerName", " ")
SQLCA.UserID = ProfileString(ls_ini,ls_section,"UserID", " ")
SQLCA.DBPass = ProfileString(ls_ini,ls_section,"DatabasePassword", " ")
SQLCA.Lock = ProfileString(ls_ini,ls_section,"Lock", " ")
SQLCA.AutoCommit = False
Connect Using sqlca;
if sqlca.sqlcode <> 0 then
MessageBox ("不能連接管理系統資料庫", sqlca.sqlerrtext)
halt
end if
同時給你'njxmq_his.ini'檔案的內容
[njxmqhisdatabase]
DBMS=MSS (Msoft) SQL Server 6.X
Database=njxmqhis_sql
UserId=
DatabasePassword=
ServerName=.
LogId=sa
Lock=
Prompt=0
LogPassword=pppppp
其中Database=njxmqhis_sql定義要連接的資料庫
LogId=sa是連接資料庫的ID
LogPassword=pppppp是ID=SA對應的密碼
ServerName=.是資料庫所在電腦的名稱,'.'代表本機
uj5u.com熱心網友回復:
嗯,LS正解。轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/117805.html
標籤:數據庫相關
