您的位置首页生活快答

VB连接DB数据库

VB连接DB数据库

的有关信息介绍如下:

VB连接DB数据库

'记得引用Microsoft Active....2.6/2.8组件

Private Sub Form_Load()

Dim con As New ADODB.Connection

Dim rs As New ADODB.Recordset

Dim constr As String

Dim sqlstr As String

constr = "driver=;server=100.1.106.10;uid=sa;pwd=admin228314;database=te"

con.ConnectionString = constr

con.Open

sqlstr = "select * from menu"

rs.Open sqlstr, con, adOpenStatic, adLockOptimistic

'rs.AddNew

Set DataGrid1.DataSource = rs

Me.DataGrid1.Refresh

End Sub

修复数据库,控制面板的ODBC中有的