VB数据库 帮忙看看为什么我的数据更新不了
PrivateSubPicture1_Click(IndexAsInteger)DimiAsIntegerDimyAsIntegerFori=0ToPicture1.UB...
Private Sub Picture1_Click(Index As Integer)
Dim i As Integer
Dim y As Integer
For i = 0 To Picture1.UBound
If i = Index And i <= 15 Then
If glkg(Index) = 0 And dlq(Index) = 0 Then
y = MsgBox("断路器未断开!", 48, "警告!")
GoTo Line1
End If
If glkg(Index) = 0 Then
Picture1(Index).Picture = LoadPicture(App.Path & "\kg2.Bmp")
glkg(Index) = 1
Form3.Data1.Recordset.AddNew
Form3.Data1.Recordset("日期") = Date
Form3.Data1.Recordset("时间") = Time
Form3.Data1.Recordset("变位位置") = Label1(Index)
Form3.Data1.Recordset("变位方式") = "合----》分"
Else
Picture1(Index).Picture = LoadPicture(App.Path & "\kg1.Bmp")
glkg(Index) = 0
Form3.Data1.Recordset.AddNew
Form3.Data1.Recordset("日期") = Date
Form3.Data1.Recordset("时间") = Time
Form3.Data1.Recordset("变位位置") = Label1(Index)
Form3.Data1.Recordset("变位方式") = "分----》合"
End If
Line1: End If
If i = Index And i > 15 Then
If glkg(Index) = 0 And dlq(Index - 16) = 0 Then
y = MsgBox("断路器未断开!", 48, "警告!")
GoTo Line2
End If
If glkg(Index) = 0 Then
Picture1(Index).Picture = LoadPicture(App.Path & "\kg3.Bmp")
glkg(Index) = 1
Form3.Data1.Recordset.AddNew
Form3.Data1.Recordset("日期") = Date
Form3.Data1.Recordset("时间") = Time
Form3.Data1.Recordset("变位位置") = Label1(Index)
Form3.Data1.Recordset("变位方式") = "合----》分"
Else
Picture1(Index).Picture = LoadPicture(App.Path & "\kg1.Bmp")
glkg(Index) = 0
Form3.Data1.Recordset.AddNew
Form3.Data1.Recordset("日期") = Date
Form3.Data1.Recordset("时间") = Time
Form3.Data1.Recordset("变位位置") = Label1(Index)
Form3.Data1.Recordset("变位方式") = "分----》合"
End If
Line2: End If
Next i
Open "glkg.txt" For Output As #2
For i = 0 To 31
Write #2, glkg(i)
Next i
Close #2
End Sub 展开
Dim i As Integer
Dim y As Integer
For i = 0 To Picture1.UBound
If i = Index And i <= 15 Then
If glkg(Index) = 0 And dlq(Index) = 0 Then
y = MsgBox("断路器未断开!", 48, "警告!")
GoTo Line1
End If
If glkg(Index) = 0 Then
Picture1(Index).Picture = LoadPicture(App.Path & "\kg2.Bmp")
glkg(Index) = 1
Form3.Data1.Recordset.AddNew
Form3.Data1.Recordset("日期") = Date
Form3.Data1.Recordset("时间") = Time
Form3.Data1.Recordset("变位位置") = Label1(Index)
Form3.Data1.Recordset("变位方式") = "合----》分"
Else
Picture1(Index).Picture = LoadPicture(App.Path & "\kg1.Bmp")
glkg(Index) = 0
Form3.Data1.Recordset.AddNew
Form3.Data1.Recordset("日期") = Date
Form3.Data1.Recordset("时间") = Time
Form3.Data1.Recordset("变位位置") = Label1(Index)
Form3.Data1.Recordset("变位方式") = "分----》合"
End If
Line1: End If
If i = Index And i > 15 Then
If glkg(Index) = 0 And dlq(Index - 16) = 0 Then
y = MsgBox("断路器未断开!", 48, "警告!")
GoTo Line2
End If
If glkg(Index) = 0 Then
Picture1(Index).Picture = LoadPicture(App.Path & "\kg3.Bmp")
glkg(Index) = 1
Form3.Data1.Recordset.AddNew
Form3.Data1.Recordset("日期") = Date
Form3.Data1.Recordset("时间") = Time
Form3.Data1.Recordset("变位位置") = Label1(Index)
Form3.Data1.Recordset("变位方式") = "合----》分"
Else
Picture1(Index).Picture = LoadPicture(App.Path & "\kg1.Bmp")
glkg(Index) = 0
Form3.Data1.Recordset.AddNew
Form3.Data1.Recordset("日期") = Date
Form3.Data1.Recordset("时间") = Time
Form3.Data1.Recordset("变位位置") = Label1(Index)
Form3.Data1.Recordset("变位方式") = "分----》合"
End If
Line2: End If
Next i
Open "glkg.txt" For Output As #2
For i = 0 To 31
Write #2, glkg(i)
Next i
Close #2
End Sub 展开
2个回答
展开全部
你数据库连上了吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询