请帮个忙,如何配置与sql server2000的数据库的配置连接.
我现在程序做好了,但是不会设置与sql server2000的数据库的配置连接,因为这个程序是客户端,请你们帮个忙,有没有通用模块,给我发过来,我的邮箱是:wxw66666@sina.com,qq:394895731. 问题点数:0、回复次数:5Top
1 楼njupt_zhb(攒钱买飞机)回复于 2005-06-04 10:09:26 得分 0
弄几个输入框,填写服务器名,数据库名,用户名和密码就可以了啊Top
2 楼aichangfeng(PowerBuilder/VB.NET)回复于 2005-06-04 12:18:03 得分 0
// Profile hotel
SQLCA.DBMS = "MSS Microsoft SQL Server 6.x"
SQLCA.Database = "hotel"
SQLCA.LogPass = "***"
SQLCA.ServerName = "(local)"
SQLCA.LogId = "sa"
SQLCA.AutoCommit = False
SQLCA.DBParm = ""
Top
3 楼princelily(百合)回复于 2005-06-04 17:05:31 得分 0
首先,需要在在服务器机子上安装好SQL Server ,设置好登陆数据库的用户名和密码。
之后,在开发机上先要在控制面板->管理工具->ODBC管理器中建立一个以SQL Server 驱动程序的数据源。测试成功后。进入PB环境中在数据库配置文件管理器中建立一个SQL Server专门驱动程序的数据库配置文件,在配置文件中选择好刚才建立的数据源。在profile中点击test connection,测试一下是否连接成功,成功后,把你看到syntax粘贴到你application对象open事件中。样子就如楼上写的那样了。嘿嘿
Top
4 楼wxx66666(人事部)回复于 2005-06-05 09:16:39 得分 0
这是在pb写原代码时要连数据库的语句,我现在是要脱离pb环境,要写个数据库配置代码,写好这个后,还有个数据库配置文件,修改这个数据库配置文件就可以决定来连接那个数据库,这些该如何做呢。Top
5 楼crtdak(云中鹤)回复于 2005-06-23 15:40:41 得分 0
你开发程序的时候不要采用直接连接,使用INI文件连接数据库最为方便。您在应用程序的OPEN事件这样写
//连接数据库
//使用connect.ini文件来连接数据库
SQLCA.DBMS = profilestring("connect.ini","database","dbms","")
SQLCA.Database = profilestring("connect.ini","database","database","")//数据库名称
SQLCA.userid = profilestring("connect.ini","database","userid","")
SQLCA.dbpass = profilestring("connect.ini","database","dbpass","")
SQLCA.LogId = profilestring("connect.ini","database","LogId","")//数据库登陆用户名称
SQLCA.LogPass = profilestring("connect.ini","database","LogPassword","")//数据库密码
SQLCA.ServerName = profilestring("connect.ini","database","ServerName","")//服务器名称
SQLCA.DBParm = profilestring("connect.ini","database","DBParm","")
SQLCA.AutoCommit = true
connect using sqlca;
if sqlca.sqlcode<>0 then
messagebox('连接失败',sqlca.sqlerrtext)
else
open(w_welcome)
end if
在应用程序的目录下面新建一个connect.ini文件,文件里面的代码如下:
[database]
dbms=MSS Microsoft SQL Server 6.x
ServerName=b05 //b05是服务器的名字,也就是主机的名字
database=bookmis //您要登陆的数据库的名字
LogPassword=2525 //登陆数据库的密码
LogId=sa //登陆数据库的用户名(默认是SA)
DBParm=
这样写就OK了。您试试。Top




