为什么VB用Adodc和DataGrid和Text时,text会自动清空数据
为什么VB用AdoDc和DataGrid和Text时,text会自动清空数据悬赏分:0-离问题结束还有14天22小时PrivateSubCommand1_Click()A...
为什么VB用AdoDc和DataGrid和Text时,text会自动清空数据
悬赏分:0 - 离问题结束还有 14 天 22 小时
Private Sub Command1_Click()
Adodc1.Recordset.AddNew
End Sub
有两个Text,点了这个那个Text没内容,点了哪个这个没内容,怎么回事??
Dim myCon As New ADODB.Connection
Dim myRec As New ADODB.Recordset
Dim myCom As New ADODB.Command
Private Sub Command1_Click()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text14.Text = "" Then
MsgBox "笔添信息没有添完,请输入完全", vbOKOnly + vbExclamation, "提示"
Else
Adodc1.Recordset.AddNew
End If
Private Sub Form_Load()
Text2.Visible = False
Label17.Visible = False
Set myCon = New ADODB.Connection
myCon.CursorLocation = adUseClient
lujing = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\新建 Microsoft Office Access 应用程序.mdb"
myCon.Open lujing
Set myRec = New ADODB.Recordset
Set myRec.ActiveConnection = myCon
Set myCom = New ADODB.Command
Set myCom.ActiveConnection = myCon
myRec.Open "select * from 表1", myCon, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = myRec
DataGrid1.Refresh
Adodc1.Refresh
End Sub 展开
悬赏分:0 - 离问题结束还有 14 天 22 小时
Private Sub Command1_Click()
Adodc1.Recordset.AddNew
End Sub
有两个Text,点了这个那个Text没内容,点了哪个这个没内容,怎么回事??
Dim myCon As New ADODB.Connection
Dim myRec As New ADODB.Recordset
Dim myCom As New ADODB.Command
Private Sub Command1_Click()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text14.Text = "" Then
MsgBox "笔添信息没有添完,请输入完全", vbOKOnly + vbExclamation, "提示"
Else
Adodc1.Recordset.AddNew
End If
Private Sub Form_Load()
Text2.Visible = False
Label17.Visible = False
Set myCon = New ADODB.Connection
myCon.CursorLocation = adUseClient
lujing = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\新建 Microsoft Office Access 应用程序.mdb"
myCon.Open lujing
Set myRec = New ADODB.Recordset
Set myRec.ActiveConnection = myCon
Set myCom = New ADODB.Command
Set myCom.ActiveConnection = myCon
myRec.Open "select * from 表1", myCon, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = myRec
DataGrid1.Refresh
Adodc1.Refresh
End Sub 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询