1.使用命令 # service mysqld status 命令来查看mysql 的启动状态,如果出现mysqld is stopped 那就说明mysql服务是停止状态
2.如果出现 mysqld is running 那就说明mysql服务是启动状态 。
3.使用命令chkconfig --list 命令来查看mysql 的启动状态,在服务中找到mysqld的服务,如果状态为off,说明mysql服务没有启动。
1、定义连接db的过程:Dim oConn As ADODB.Connection
Private Sub ConnectDB()
Set oConn = New ADODB.Connection
oConn.Open "DRIVER={MySQL ODBC 5.1 Driver}" &_
"SERVER=localhost" &_
"DATABASE=yourdatabase" &_
"USER=yourdbusername" &_
"PASSWORD=yourdbpassword" &_
"Option=3"
End Sub
2、执行db插入的具体写法:
Dim rs As ADODB.Recordset
Private Sub InsertData()
Set rs = New ADODB.Recordset
ConnectDB
With wsBooks
For rowCursor = 2 To 11
strSQL = "INSERT INTO tutorial (author, title, price) " &_
"VALUES ('" &esc(.Cells(rowCursor, 1)) &"', " &_
"'" &esc(.Cells(rowCursor, 2)) &"', " &_
esc(.Cells(rowCursor, 3)) &")"
rs.Open strSQL, oConn, adOpenDynamic, adLockOptimistic
Next
End With
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)