是否执行了cnn.open
连接没有打开。
连接没有打开。
解决方案 »
- 为什么改版后回帖要先生成帖子呢?
- 如何是输入焦点回到指定的控件
- LABEL显示不完全的问题
- 我通过程序传了一个参数,是某个窗体的名称,我怎么才可以把这个窗体显示出来啊?
- 判断是否是Activeform
- 有没有哪位大高手,用datagrid作过程序。简单的。只要能添加删除修改就成。
- 在textbox或label控件中如何使字竖向显示
- vb连接SQL 2000,运行是出现用户sa 登入失败!求救!!!
- 请熟悉delphi的朋友帮忙(斑竹熟吗)
- 只能够PING如:202.168.0.25 这中形式的IP,却不能够PING象网址之类如:www.csdn.net...
- VB里怎么用findwindow、GetWindowProcessID、writeprocessmemory
- 如何自己编写DLL文件
Cnn = Server.CreateObject("ADODB.Connection")
然后打开数据库引擎:
StrCnn$ = "你的数据库类型、密码和数据库名称"
//格式请参看一些书籍我有ASP的类似格式不知能够套用到vb中
Cnn.Open(StrCnn)
......
Option Explicit
Public cnn As ADODB.Connection
Public Rs As New ADODB.Recordset
Function FunSqlLink() As IntegerDim LocalPath As String
Dim cnn As ADODB.ConnectionLocalPath = App.Path & "\"
On Error GoTo InitializeError
Set cnn = New ADODB.Connection
cnn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & LocalPath & "quantity.mdb;Persist Security Info=False;jet oledb")
FunSqlLink = 1
Exit FunctionInitializeError:
FunSqlLink = 0
End FunctionFunction FunSqlClose() As Integer
On Error GoTo CloseError
Rs.Close
Set Rs = Nothing
cnn.Close
Set cnn = Nothing
FunSqlClose = 1Exit FunctionCloseError
FunSqlClose = 0
End Function
有什么问题吗?请帮忙看一下.一个礼拜了还未解决,很惨.谢谢了.