我用udl连接本地的程序,没有问题,我把程序和udl拿到局域网的另外一台电脑就有,开始连半天连不到,但是不知道怎么又连上了又,但是把同样的程序和udl文件放到局域网的另外一台电脑就又怎么也连不到,不知道社么原因。我的udl用记事本打开:
[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLOLEDB.1;Password=salut;Persist Security Info=True;User ID=sa;Initial Catalog=myWork;Data Source=192.168.7.48我本身的ip是192.168.7.48
我在C:\WINDOWS\system32\drivers\etc的hosts文件最后也添加了我的ip192.168.7.48:
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
127.0.0.1       localhost
192.168.7.48
不知道是哪里出了问题。
还有如果用udl的ODBC配置,测试能连接成功但是用程序打开的时候报错:
[Microsoft][ODBC SQL Server Driver]字符串数据,右截位.