编一个vb程序,要求能对数据库的资料进行增删改查
2个回答
2013-11-26
展开全部
用Adodc控件来作 添加该控件的步骤: project(工程)->component(部件)->Microsoft ADO Data Control 6.0(OLEDB)
代码:
Private Sub Command1_Click()
Adodc1.Recordset.AddNew
Text1.Text = ""
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Adodc1.Recordset.Update
End Sub
Private Sub Command3_Click()
datareport1.Show
End Sub
Private Sub Command4_Click()
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
End Sub
Private Sub Command5_Click()
Text5.Text = Val(Text3.Text) - Val(Text4.Text)
Text6.Text = Val(Text5.Text) * 0.5
End Sub
Private Sub Command7_Click()
Adodc1.Recordset.Edit
End Sub
代码:
Private Sub Command1_Click()
Adodc1.Recordset.AddNew
Text1.Text = ""
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Adodc1.Recordset.Update
End Sub
Private Sub Command3_Click()
datareport1.Show
End Sub
Private Sub Command4_Click()
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
End Sub
Private Sub Command5_Click()
Text5.Text = Val(Text3.Text) - Val(Text4.Text)
Text6.Text = Val(Text5.Text) * 0.5
End Sub
Private Sub Command7_Click()
Adodc1.Recordset.Edit
End Sub
2013-11-26
展开全部
adodb 控件
Set Cn = New ADODB.Connection
Cn.ConnectionString = "路径名"
If Cn.State = adStateClosed Then Cn.Open
Set Cn = New ADODB.Connection
Cn.ConnectionString = "路径名"
If Cn.State = adStateClosed Then Cn.Open
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询