compiler-errors - VB6-找不到方法或数据成员

标签 compiler-errors vb6

当我尝试在VB 6.0中运行此项目时,出现的错误是:找不到方法或数据成员
当我将文本方法定义到文本框时,文本方法出现错误,文本框可用的方法是计数项lbound ubound。
请帮我解决。

    Private Sub btnSubmit_Click(Index As Integer)
Dim db_file As String
Dim statement As String
Dim conn As ADODB.Connection
Dim ctl As Control

db_file = App.path
If Right$(db_file, 1) <> "\" Then db_file = db_file & "\"
db_file = db_file & "MyDB.mdb"

Set conn = New ADODB.Connection
conn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & db_file & ";" & _
"Persist Security Info=False"
conn.Open

statement = "INSERT INTO MyTable " & "(Job_Date, Client, Final_Product, Description) " & _
'" VALUES (" & "'" & Date & "', " & "'" & txtClient.Text & "', " & "'" & txtFinalProduct.Text & "', " & "'" & txtDescription.Text & "'" & ")"
conn.Execute statement, , adCmdText
conn.Close
msgbox "Done"
End Sub 

最佳答案

代替这个

statement = "INSERT INTO MyTable " & "(Job_Date, Client, Final_Product, Description) " & _
'" VALUES (" & "'" & Date & "', " & "'" & txtClient.Text & "', " & "'" & txtFinalProduct.Text & "', " & "'" & txtDescription.Text & "'" & ")"
。 。 。将注释开始'移到上一行的串联运算符&之前,像这样
statement = "INSERT INTO MyTable " & "(Job_Date, Client, Final_Product, Description) " ' & _
    " VALUES (" & "'" & Date & "', " & "'" & txtClient.Text & "', " & "'" & txtFinalProduct.Text & "', " & "'" & txtDescription.Text & "'" & ")"
。 。 。否则,它仍然希望连接一个未提供的字符串。

关于compiler-errors - VB6-找不到方法或数据成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63031507/

相关文章:

text - 哈希对 VB 中的变量有什么作用?

process - Process.Start 的 VB 6 等价物是什么?

multithreading - 在 VB6 中设置线程文化

eclipse - 为什么我必须定期清理 Eclipse 中的一个特定项目?

c# - 为什么使用 ConditionalAccessExpression 会改变我的扩展方法的工作方式?

vb6 - 如何将整个 VB6 项目保存到新文件夹?模块和所有

memory-leaks - 没有 GDI 泄漏的 VB6 内存泄漏

c# - 如何摆脱编译器错误: C# use of unassigned local variable?

c# - 类、结构或接口(interface)成员声明中的标记无效

git - 移动git项目导致许多Blob和树错误