标签:
用代码创建控件:例创建文本框 | 打开网站代码 |
Dim T As Object | Shell "explorer http://www.baidu.com" |
Static Num As Long | |
Set T = Me.Controls.Add("VB.textbox", "Text" & Num, Me) ‘第一个参数是要添加的控件,第二个是控件名 | 打开记事本 |
T.Left = 122 ‘设置 左边距离 | Shell "notepad.exe", vbNormalFocus |
T.Top = 122 + Num * 600 ‘设置顶部距离 | |
Num = Num + 1 ‘防止控件名重复 | |
T.Visible = True ‘设置控件可见 | |
MSGBOX 判断是否 | |
If MsgBox("你真的想退出吗? ", vbYesNo, "退出提示 ") = vbYes Then | |
End | |
Else | |
Cancel = True | |
End If | |
A_Index.Adoo.CommandType = adCmdText | |
A_Index.Adoo.RecordSource = "Select * From Categories" | |
A_Index.Adoo.Refresh | |
数据库连接代码 | |
Dim RunSql, SqlStr As String | |
Dim Conn As New ADODB.Connection | |
Dim Rs As New ADODB.Recordset | |
Conn.OPEN "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\ERP.mdb;" | |
Rs.CursorLocation = adUseClient | |
RunSql = RunSqlText.Text | |
Rs.OPEN RunSql, Conn, 1, 3 | |
SqlStr = LCase(Left(Trim(RunSql), 6)) | |
If SqlStr = "select" Then | |
Set ViewBox.DataSource = Rs | |
Else | |
Rs.OPEN "Select * From Sale", Conn, 1, 3 | |
Set ViewBox.DataSource = Rs | |
End If | |
Adodc1.Recordset.Close | |
Adodc1.CommandType = adCmdText | |
Adodc1.Recordset.ActiveConnection.Execute SQL | |
Adodc1.Refresh | |
Adodc1.Recordset.ActiveConnection.Execute "UPDATE sale SET 商品单价 = ‘13002‘" | |
Adodc1.Refresh | |
INSERT INTO Categories (产品分类编号,产品分类名称) VALUES (‘g‘,‘g‘) |
标签:
原文地址:http://www.cnblogs.com/vov5601/p/4598454.html