VB6.0同一工程不同的form连接统一个数据库的问题,求大神解决。 10
错误为子程序或函数中的属性无效form1中:PublicjAsIntegerPrivateSubForm1_Load()PubliccnnAsNewADODB.Conne...
错误为子程序或函数中的属性无效
form1中:
Public j As Integer
Private Sub Form1_Load()
Public cnn As New ADODB.Connection
Public rs As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "E\VB工程\access\tycs.MDB"
rs.Open "select * from YJCS", cnn, adOpenKeyset, adLockOptimistic
Set MSHFlexGrid1.DataSource = rs
MSHFlexGrid.colWidth(0) = 100
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\access\tycs.mdb"
rs.Open "select * from YJCS where 编号=" & j, cnn, adOpenKeyset, adLockOptimistic
xnow = rs.Fields("X1")
ynow = rs.Fields("Y1")
rs.Fields("X1") = xnow + x2 - x1
rs.Fields("Y1") = ynow + y2 - y1
rs.Update
rs.Close
Picture1.Cls
Call updata
End If
End Sub
form2中
Public j As Integer
Private Sub Command1_Click()
Public cnn As New ADODB.Connection(调试错误指示位置)
Public rs As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\access\tycs.mdb"
rs.Open "select * from YJCS where 编号=" & j, cnn, adOpenKeyset, adLockOptimistic
If rs.EOF = False Then
rs.Fields("额定容量") = Form2.Text1.Text
rs.Fields("额定频率") = Form2.Text2.Text
rs.Update
rs.Close
End Sub 展开
form1中:
Public j As Integer
Private Sub Form1_Load()
Public cnn As New ADODB.Connection
Public rs As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "E\VB工程\access\tycs.MDB"
rs.Open "select * from YJCS", cnn, adOpenKeyset, adLockOptimistic
Set MSHFlexGrid1.DataSource = rs
MSHFlexGrid.colWidth(0) = 100
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\access\tycs.mdb"
rs.Open "select * from YJCS where 编号=" & j, cnn, adOpenKeyset, adLockOptimistic
xnow = rs.Fields("X1")
ynow = rs.Fields("Y1")
rs.Fields("X1") = xnow + x2 - x1
rs.Fields("Y1") = ynow + y2 - y1
rs.Update
rs.Close
Picture1.Cls
Call updata
End If
End Sub
form2中
Public j As Integer
Private Sub Command1_Click()
Public cnn As New ADODB.Connection(调试错误指示位置)
Public rs As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\access\tycs.mdb"
rs.Open "select * from YJCS where 编号=" & j, cnn, adOpenKeyset, adLockOptimistic
If rs.EOF = False Then
rs.Fields("额定容量") = Form2.Text1.Text
rs.Fields("额定频率") = Form2.Text2.Text
rs.Update
rs.Close
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询