当前位置:编程学习 > VB >>

那位大哥帮助一下小弟新学VB

Private Function SuppInfo_Add() As Boolean
    Dim rst As New ADODB.Recordset
    Dim strSQL As String
    Dim intRst As Integer
    
    SuppInfo_Add = False
    If CheckFaceIsOk = False Then
        Exit Function
    End If
    strSQL = "SELECT * FROM 入库 where 编号 = " & Me.txt5.Text & ""
    rst.Open strSQL, cnnDatabase, adOpenStatic, adLockOptimistic
    
    rst.AddNew
    rst.Fields("名称").Value = Me.txt1.Text
    rst.Fields("入库时间").Value = Me.DT_RegeditDate.Value
    rst.Fields("仓管员").Value = Me.txt2.Text
    rst.Fields("入库数量").Value = Me.txt3.Text
    rst.Fields("编号").Value = Me.txt5.Text
    rst.Fields("入库人").Value = Me.txt6.Text
    rst.Fields("线体").Value = Me.txt8.Text
    
    If Me.txt4.Text = "" Then
        rst.Fields("备注").Value = "无"
    Else
        rst.Fields("备注").Value = Me.txt4.Text
    End If
    On Error Resume Next
    rst.Update
    MsgBox "添加新的物品信息成功!"
    Set rst = Nothing
    
    kucun_Add
    
    Initial_Add
    SuppInfo_Add = False
    Exit Function
    

    
End Function

实时错误 '-2147217904  (80040e10)'
[Microsoft][ODBC Microsoft Access Driver] 参数不足,期待是 1 --------------------编程问答-------------------- 那个大哥帮忙告诉该怎么改 谢谢了! --------------------编程问答-------------------- cnnDatabase 定义在哪里?
检查连接字符串。 --------------------编程问答-------------------- 数据库连接错误,你应该把连接数据库那段代码放出来看看是哪里错了 --------------------编程问答-------------------- ODBC 数据源错误,应该是数据库连接出问题了,代码应该是没有问题的 --------------------编程问答-------------------- cnnDatabase的连接字符串肯定有问题。给你个实例代码吧
cnnDatabase.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\me.mdb" --------------------编程问答-------------------- 唉。。我也是新学 遇到困难了 发不了帖子啊。。有人能帮忙解答下吗
http://zhidao.baidu.com/question/154992812.htm --------------------编程问答-------------------- ActiveX Data Objects (ADO) imposes no restrictions on the syntax used to generate a recordset or execute a statement. This comes from the underlying native provider, such as the OLE DB provider for Index Server, or the OLE DB provider for ODBC drivers. Valid syntax required for using ADO successfully is defined by the underlying OLE DB provider. When migrating SQL syntax to ADO, you will need to consider this for SQL statements such as the following, which works when using DAO to go to the Microsoft Access Jet engine: 


   INSERT INTO Authors ( Au_ID, Author ) VALUES (  54, "Record # 54" )


However, with ADO (to the OLE DB provider for ODBC drivers via the Microsoft Access ODBC driver) this syntax generates an error and fails to execute. 
With ADO, this syntax generates an error, 0x80040E10 or -2147217904, or the following error message: 


   Too few parameters.  Expected 1.


Instead, you would have to use the following syntax: 

   INSERT INTO Authors ( Au_ID, Author ) VALUES (  54, 'Record # 54' )


This is only one example and specific to DAO/Jet.  --------------------编程问答-------------------- 友情Up...........
--------------------编程问答-------------------- 同意5楼的
--------------------编程问答-------------------- cnnDatabase 在哪里 你不设置这个不行哦 --------------------编程问答--------------------
补充:VB ,  基础类
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,