vb操作sql数据库的典型例子
本程序有一菜单开始,里面有查询,删除,修改,添加,程序不一一列出,只写出基本的过程,连接数据库采用标准模块:
'Public publicstr As String
Public conn As ADODB.Connection
Public rs As ADODB.Recordset
Public Sub main() '数据库连接共享函数
Set conn = New ADODB.Connection
conn.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=plgl;Initial Catalog=plgl"
'publicstr = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=plgl;Initial Catalog=plgl" '共享连接字符串
main_pfm.Show
End Sub
添加程序:
Set rs = New ADODB.Recordset
If Trim(Text1(0).Text) = "" Then
smeg = "配方号不能为空!!!"
MsgBox smeg, vbOKCancel + vbExclamation, "警告"
Text1(0).SetFocus
Else
If Not IsNumeric(Text1(0).Text) Then
smeg = "A添加剂非数字!!!"
MsgBox smeg, vbOKCancel + vbExclamation, "警告"
Text1(0).Text = ""
Text1(0).SetFocus
Else
If Trim(Text1(1).Text) = "" Then
smeg = "配方名称不能为空!!!"
MsgBox smeg, vbOKCancel + vbExclamation, "警告"
Text1(1).SetFocus
Else
If Trim(Text1(2).Text) = "" Then
smeg = "A添加剂不能为空!!!"
MsgBox smeg, vbOKCancel + vbExclamation, "警告"
Text1(2).SetFocus
Else
If Not IsNumeric(Text1(2).Text) Then
&n
相关文档:
通过调用CreateDataSetfromXml取得XML数据
Imports System.Xml
Public Const FILE_CONFIG = "MZZ.xml"
Public Const PATH_CONFIG = "\XML\"
Dim dstXML As DataSet
Dim tblXML_DB As DataTable
Dim dtCod As New DataTable
Dim strSQL As String = ""
clsPublic ......
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Const EWX_LOGOFF = 0
Private Const EWX_SHUTDOWN = 1
Private Const EWX_REBOOT = 2
Private Const EWX_FORCE = 4
Private closeTime As String
Sub AdjustTokenPrivilegesForNT()
......
VB显示透明FLASH效果
演示效果:
代码如下:
公共声明区域
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetW ......
Option Explicit
Public Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Public Declare Function RegCreateKey Lib "advapi32.dll" Alias ......
http://www.carlosag.net/Tools/CodeTranslator/ 这个也许学计算机的哥哥姐姐们会用得到,,就转了希望多多支持哦 西西 用得到就顶哦
差点忘了哦 ,藕还有一个sql的插件很好用的呀。。。。有想要的就留言下要咯。。。。。 ......