Dim cnn As New Connection出错!!!

liyan010 2004-04-28 11:28:44
在执行的时候,vb提示“编译错误:找不到工程或库”,这是怎么回事?

是不是引用不对?

怎么解决?
...全文
44 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
liyan010 2004-04-28
  • 打赏
  • 举报
回复
ok,感谢大家
flc 2004-04-28
  • 打赏
  • 举报
回复

引用Microsoft Activex Data Object 2.5 Library

Dim cnn As ADODB.Connection
set cnn=new ADODB.Connection


lxcc 2004-04-28
  • 打赏
  • 举报
回复
引用ADO了吗?
Microsoft Activex Data Object 2.x Library
另外应该是:
Dim cnn As New ADODB.Connection
whachun 2004-04-28
  • 打赏
  • 举报
回复
有些机子上就是这样子的,我也碰到过
whachun 2004-04-28
  • 打赏
  • 举报
回复
你就定义成New ADODB.Connection
漂亮的界面,可执行的代码 菜谱管理: Dim cnn As New ADODB.Connection Dim rsImage As New ADODB.Recordset Dim Chunk() As Byte Dim lngLengh As Long Dim intChunks As Integer Dim intFragment As Integer Const ChunkSize = 1000 Const lngDataFile = 1 Dim sql As String Private Sub back_Click() End Sub Private Sub Command1_Click(Index As Integer) Set DataGrid1.DataSource = Nothing sql = "delete * from huncai where cname='" & (Text1(2).Text) & "'" cnn.Execute sql MsgBox ("成功删除信息") Adodc1.Recordset.Update Adodc1.Refresh Set DataGrid1.DataSource = Adodc1 End Sub Private Sub Command2_Click() End End Sub Private Sub Command3_Click() If Text3.Text = "" Or Text4.Text = "" Then MsgBox ("请输入完整信息!") Else sql = "insert into huncai(sort,cname,price) values ('" & (Combo1.Text) & "' ,'" & (Text3.Text) & "' ,'" & Val(Text4.Text) & "')" If Trim(txtFilePath.Text) = "" Then MsgBox "未选择文件.!!", vbInformation + vbSystemModal, "保存出错" Exit Sub End If Open Trim(txtFilePath.Text) For Binary Access Read As lngDataFile lngLengh = LOF(lngDataFile) ' 文件大小 If lngLengh = 0 Then Close lngDataFile: Exit Sub intChunks = lngLengh \ ChunkSize intFragment = lngLengh Mod ChunkSize '新建记录 rsImage.AddNew ReDim Chunk(intFragment) Get lngDataFile, , Chunk() rsImage!picImage.AppendChunk Chunk() ReDim Chunk(ChunkSize) For i = 1 To intChunks Get lngDataFile, , Chunk() rsImage!picImage.AppendChunk Chunk() Next i rsImage.Update Close lngDataFile Call ShowPic cnn.Execute sql Adodc1.Refresh MsgBox ("添加成功!") End If End Sub Private Sub cmdBrowse_Click() On Error Resume Next With cmdlFilePath .Filter = "JPG Files|*.JPG|Bitmaps|*.BMP" .ShowOpen txtFilePath.Text = .FileName End With

1,216

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧