请问SQL SERVER2000 的 ODBC驱动文件在哪啊 怎么找???
请详细介绍谢谢大家了
请详细介绍谢谢大家了
解决方案 »
- 有什么控件可以用代码生成多层菜单的,高手帮帮我吧?
- 控件和组件有什么不同?
- 我下面的语句不能打开access2000,只能打开access97,我应该怎样改?
- 装了microsoft studio后vb 不能用呀!
- 如何让VB自动使用帐号和密码登录??
- 我是菜鸟求助vb问题
- 用Inet2.GetHeader("Last-modified")得到修改日期时间,如何转换成北京时间
- 请问各位一个关于ASP的问题!在线等待!
- 十万火急,高分酬劳。vb的要实现vfp的宏代换怎么办?百思但就是不其解?
- 再次求救一个问题:谁有好的(没有BUG的)RICHTEXTBOX控件?解决了我再给160分!
- 在那里可以下载vb方面的英文书籍?
- 请教: 请问怎样VB把string类型转换成其他语言的char类型?
而是类式 ODBC驱动(Driver) c:\sqlany50\win32\wod50t.dll
我想找那个文件
另外加一个问题就是
可以在一个SQL SERVER2000数据库中在建立其他的数据库么???
例如: 我现在在 数据库A 中进行操作,我想通过A再建立一个B数据库,可以实现么???
不知道可行否
如果需要在其它的系统或配置其它的数据库,可以自己分析注册表[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC]下的内容,并实现自己的需求。'SQL Server
Option Explicit
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_PERFORMANCE_DATA = &H80000004
Const HKEY_CURRENT_CONFIG = &H80000005
Const HKEY_DYN_DATA = &H80000006
Const REG_NONE = 0
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD = 4
Const REG_DWORD_BIG_ENDIAN = 5
Const REG_MULTI_SZ = 7Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Sub Command1_Click()
Dim hKey As Long
Dim DSNName, strDriver, strServer, strDatabase, strLastUser, strDBType As StringDSNName = "MYSQLODBC"strDriver = "C:\\WINNT\\System32\\sqlsrv32.dll" 'SQL Server的驱动,如果用VFP可以改成相应的文件
strServer = "SERVER"
strDatabase = "test"
strLastUser = "sa"
strDBType = "SQL Server"RegCreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources", hKey
RegSetValueEx hKey, DSNName, 0, REG_SZ, ByVal strDBType, Len(strDBType) + 1RegCreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBC.INI\" & DSNName, hKey
RegSetValueEx hKey, "Driver", 0, REG_EXPAND_SZ, ByVal CStr(strDriver), Len(strDriver) + 1
RegSetValueEx hKey, "Server", 0, REG_SZ, ByVal CStr(strServer), Len(strServer) + 1
RegSetValueEx hKey, "Database", 0, REG_SZ, ByVal CStr(strDatabase), Len(strDatabase) + 1
RegSetValueEx hKey, "LastUser", 0, REG_SZ, ByVal CStr(strLastUser), Len(strLastUser) + 1
End Sub'VFP 目录
Option Explicit
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_PERFORMANCE_DATA = &H80000004
Const HKEY_CURRENT_CONFIG = &H80000005
Const HKEY_DYN_DATA = &H80000006
Const REG_NONE = 0
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD = 4
Const REG_DWORD_BIG_ENDIAN = 5
Const REG_MULTI_SZ = 7Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Sub Command1_Click()
Dim hKey As Long
Dim DSNName, strDriver, strDBType As String
dim strSourceDB,strDescription,strSourceType,strBackgroundFetch,strExclusive,strNull,strDeleted,strCollate,strSetNoCountOn as stringDSNName = "MYVFPODBC"strDriver="C:\\WINNT\\System32\\vfpodbc.dll"
strSourceDB="c:\\VFPDB"
strDescription="VFP DB"
strSourceType="DBF"
strBackgroundFetch="Yes"
strExclusive="No"
strNull="Yes"
strDeleted="Yes"
strCollate="Machine"
strSetNoCountOn="No"
strDBType = "Microsoft FoxPro VFP Driver (*.dbf)"RegCreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources", hKey
RegSetValueEx hKey, DSNName, 0, REG_SZ, ByVal strDBType, Len(strDBType) + 1RegCreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBC.INI\" & DSNName, hKey
RegSetValueEx hKey, "Driver", 0, REG_EXPAND_SZ, ByVal CStr(strDriver), Len(strDriver) + 1
RegSetValueEx hKey, "SourceDB", 0, REG_SZ, ByVal CStr(strSourceDB), Len(strSourceDB) + 1
RegSetValueEx hKey, "Description", 0, REG_SZ, ByVal CStr(strDescription), Len(strDescription) + 1
RegSetValueEx hKey, "SourceType", 0, REG_SZ, ByVal CStr(strSourceType), Len(strSourceType) + 1
RegSetValueEx hKey, "BackgroundFetch", 0, REG_SZ, ByVal CStr(strBackgroundFetch), Len(strBackgroundFetch) + 1
RegSetValueEx hKey, "Exclusive", 0, REG_SZ, ByVal CStr(strExclusive), Len(strExclusive) + 1
RegSetValueEx hKey, "Null", 0, REG_SZ, ByVal CStr(strNull), Len(strNull) + 1
RegSetValueEx hKey, "Deleted", 0, REG_SZ, ByVal CStr(strDeleted), Len(strDeleted) + 1
RegSetValueEx hKey, "Collate", 0, REG_SZ, ByVal CStr(strCollate), Len(strCollate) + 1
RegSetValueEx hKey, "SetNoCountOn", 0, REG_SZ, ByVal CStr(strSetNoCountOn), Len(strSetNoCountOn) + 1
End Sub
内容 用连接字符串来连接数据库就是说你的数据库连接不用ODBC配置的DSN文件来连接,在程序中字符串方式来做。
比如:
strcon = "Provider=SQLOLEDB;Driver={SQL Server};Server=Server;Uid=sa" & _
";Pwd=1;Database=data"
adoCN.Open strcon
说明:strcon中存放的就是连接数据库的字符串,这个要比ODBC方便多了。