本文介绍了将'ADODB.Field'转换为'String'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnview.Click
connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\db1.mdb;Persist Security Info=False"
conn.Open(connectionstring)
rs.Open("select * from table1 where Name='" & snm.Text & "'")
' If rs.EOF Then
'rs.AddNew()
'End If
conn = New ADODB.Command
If Not rs.EOF Then
sid.Text = rs.Fields(0)
snm.Text = rs.Fields("Name")
sadd.Text = rs.Fields("Address")
scno.Text = rs.Fields("Contact_Number")
svat.Text = rs.Fields("Vat")
'rs.Fields(0) = sid.Text
'rs.Fields(1) = snm.Text
'rs.Fields(2) = sadd.Text
'rs.Fields(3) = scno.Text
'rs.Fields(4) = svat.Text
Else
sid.Text = ""
snm.Text = ""
sadd.Text = ""
scno.Text = ""
svat.Text = ""
End If
'rs.Close()
rs = Nothing
MsgBox("done")
End Sub
这是我的代码。
我收到错误将'ADODB.Field'转换为'String'时可能会出现运行时错误,我该如何解决这个问题?
This is my code.
I get an error "Runtime errors might occur when converting 'ADODB.Field' to 'String'", how can I solve this issue?
推荐答案
这篇关于将'ADODB.Field'转换为'String'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!