雖然 VB 已死。。但用來寫寫桌面小軟件還是挺不錯的。不過我算是還給了老師。。忘的差不多了。。~~~~~~~~~~
?????????????????? 很早以前用VB寫的。。。也就幾行代碼。。。。沒有一點技術含量
????????????????? 下載 無需 安裝。。直接運行即可。。
???截圖:??????
???????

下載地址:
http://www.tkk7.com/Files/wujun/mysoft.rar關鍵代碼:
鏈接數據庫:

Public?Function?contoserver()Function?contoserver()?As?Boolean?'連接數據庫函數
On?Error?GoTo?Conerror
????con.CursorLocation?=?adUseClient
????con.ConnectionString?=?"Provider=Microsoft.Jet.OLEDB.4.0;"?&?"Data?Source="?&?App.Path?&?"\db.mdb;"?&?"Persist?Security?Info=False"
????'con.ConnectionString?=?"Provider=Microsoft.Jet.OLEDB.4.0;Password=wujunainiyiwn;Data?Source=E:\數據\vars.mdb;Persist?Security?Info=True"
????con.CommandTimeout?=?20
????con.Open
????contoserver?=?True
????Exit?Function
Conerror:
???MsgBox?"問題,!",?vbExclamation?+?vbOKOnly,?"嚴重問題"
????contoserver?=?False
End?Function


Public?Function?closecon()Function?closecon()?As?Boolean?'關閉連接的函數
On?Error?Resume?Next
????If?(Not?con?Is?Nothing)?Then?con.Close
????Set?con?=?Nothing
End?Function


Public?Function?runSQL()Function?runSQL(ByVal?strsql?As?String)?As?Boolean?'執行查詢語句的函數
On?Error?GoTo?runerror
????Set?rst?=?Nothing
????Set?rst?=?New?ADODB.Recordset
????rst.Open?strsql,?con,?adOpenDynamic,?adLockOptimistic,?-1
????runSQL?=?True
????Exit?Function
runerror:
???MsgBox?"運行這句出錯了",?vbExclamation?+?vbOKOnly,?"提示"
'???MsgBox?"錯誤編號:"?&?Err.Number?&?vbCrLf?_
????&?"錯誤描述:"?&?Err.Description,?vbCritical?+?vbOKOnly,?"連接錯誤"
????runSQL?=?False
End?Function


小技巧:
VB 引入超鏈接按鈕
??????? 1.定義

Private?Declare?Function?ShellExecute()Function?ShellExecute?Lib?"shell32.dll"?Alias?"ShellExecuteA"?(ByVal?hWnd?As?Long,?ByVal?lpOperation?As?String,?ByVal?lpFile?As?String,?ByVal?lpParameters?As?String,?ByVal?lpDirectory?As?String,?ByVal?nShowCmd?As?Long)?As?Long

?? 2.使用
?
?ShellExecute?Me.hWnd,?"open",?"http://www.tkk7.com/wujun",?vbNullString,?vbNullString,?vbNormalFocustextBox 只能輸入數字:

Private?Sub?Text2_KeyPress()Sub?Text2_KeyPress(KeyAscii?As?Integer)
??Dim?a?As?Boolean
a?=?Chr(KeyAscii)?Like?"[0-9]"?Or?KeyAscii?=?8
If?a?=?False?Then
????KeyAscii?=?0
????MsgBox?"這里輸入的可是要數字的哦!",?vbInformation?+?vbOKOnly,?"提示"
End?If
End?Sub