В общем благодаря вашим усилиям мне помочь, написал Class по работе с ODBC (MySql), сейчас его использую сам, но если у вас будут предложения или Вы заметите ошибку прошу сообщение
<div class="sp-wrap"><div class="sp-head-wrap"><div class="sp-head folded clickable">Class по работе с ODBC (MySql)</div></div><div class="sp-body"><div class="sp-content"><!--shcode--><pre><code class='vb'>Class MySQL
Private Connect As Odbcconnection
Private Query As Odbcquery
Private SQLTEXT As String
Private DSN As String
Private RowCount As Integer
Private exLastError As String
Private exActive As Boolean
Public Field List As TField
Public Result As Odbcresultset
Property Set SQL As String
SQLTEXT = SQL
End Property
Property Get RecordCount As Integer
If (Result Is Nothing) Or (ReqType = "") Then RecordCount = "-1" Else RecordCount = RowCount
End Property
Property Set Active As Boolean
If DSN = "" Then
Error 9111, "Check up options DSN"
End If
Set Connect = New ODBCConnection
If Active Then
If (Connect Is Nothing Or Not Connect.IsConnected) Then
Connect.SilentMode = True
If Connect.ConnectTo(DSN) Then
Active = True
Else
Active = False
End If
Else
Active = True
End If
Else
Active = Not Disconnect()
End If
exActive = Active
End Property
Property Get Active As Boolean
Active = exActive
End Property
Property Set ParamByName(ParamName As String) As String
If SQLTEXT <> "" Then SQLTEXT = Replace(SQLTEXT,":" + ParamName, ParamByName)
End Property
Private Sub ReInitializeClass
Set Query = Nothing
Set Result = Nothing
exLastError = ""
RowCount = 0
End Sub
Sub New(DSN_Name As String)
Set Connect = Nothing
DSN = DSN_Name
Call ReInitializeClass
End Sub
Sub Delete
Call Disconnect()
End Sub
Public Function Disconnect() As Boolean
If Connect Is Nothing Then Error 9110, "Is no connection"
If Connect.IsConnected Then
Connect.Disconnect
Disconnect = True
Else
Disconnect = True
End If
End Function
'-----------------------------------------------
Private Function ReqType() As String
ReqType = UCase$(Mid$(SQLTEXT, 1,1))
End Function
Public Function LastError() As String
If Connect Is Nothing Then Error 9110, "Is no connection"
LastError = exLastError
End Function
Private Function GetDataType(typeConst As Integer) As String
Select Case typeConst
Case SQL_CHAR : GetDataType = "CHAR"
Case SQL_NUMERIC : GetDataType = "NUMERIC"
Case SQL_DECIMAL : GetDataType = "DECIMAL"
Case SQL_INTEGER : GetDataType = "INTEGER"
Case SQL_SMALLINT : GetDataType = "SMALLINT"
Case SQL_FLOAT : GetDataType = "FLOAT"
Case SQL_REAL : GetDataType = "REAL"
Case SQL_DOUBLE : GetDataType = "DOUBLE"
Case SQL_DATE : GetDataType = "DATE"
Case SQL_TIME : GetDataType = "TIME"
Case SQL_TIMESTAMP : GetDataType = "TIMESTAMP"
Case SQL_VARCHAR : GetDataType = "VARCHAR"
Case SQL_BINARY : GetDataType = "BINARY"
Case SQL_VARBINARY : GetDataType = "VARBINARY"
Case SQL_LONGVARCHAR : GetDataType = "LONGVARCHAR"
Case SQL_LONGVARBINARY : GetDataType = "LONGVARBINARY"
Case SQL_BIGINT : GetDataType = "BIGINT"
Case SQL_TINYINT : GetDataType = "TINYINT"
Case SQL_BIT : GetDataType = "BIT"
End Select
End Function
Function SQLExec() As Boolean
Call ReInitializeClass
SQLExec = False
Dim i As Integer
If Connect Is Nothing Then Error 9110, "There is no connection with server MySQL"
If SQLTEXT = "" Then Error 9109, "Check up SQL inquiry"
Set Query = New ODBCQuery
Set Result = New ODBCResultSet
Set Query.Connection = Connect
Set Result.Query = Query
Query.SQL = SQLTEXT
SQLExec = Result.Execute()
If Result.Isresultsetavailable() Then
RowCount = Result.NumRows
Erase Field
If Result.NumRows <> 0 Then
For i = 1 To Result.NumColumns
Field(Result.Fieldname(i)).Value = Result.GetValue(i)
Field(Result.Fieldname(i)).DataTypes = GetDataType(Result.FieldNativeDataType(i))
Next
End If
Else
Set Result = Nothing
End If
If Not SQLExec Then exLastError = Result.Geterrormessage()
End Function
Sub NextRow()
If Connect Is Nothing Then Error 9110, "Is no connection"
If (Result Is Nothing) Or (ReqType = "") Then Exit Sub
Dim c As Integer
Erase Field
Call Result.Nextrow()
For c = 1 To Result.NumColumns
Field(Result.Fieldname(c)).Value = Result.GetValue(c)
Field(Result.Fieldname(c)).DataTypes = GetDataType(Result.FieldNativeDataType(c))
Next
End Sub
Function isEofRow()
If Connect Is Nothing Then Error 9110, "Is no connection"
If (Result Is Nothing) Or (ReqType = "") Then
isEofRow = true
Else
isEofRow = Result.Isendofdata()
End If
End Function
End Class[/CODE]
Ну и сам <div class="sp-wrap"><div class="sp-head-wrap"><div class="sp-head folded clickable">пример использования</div></div><div class="sp-body"><div class="sp-content"><!--shcode--><pre><code class='vb'>Function TestSelect() As Boolean
On Error GoTo eline
Dim MySQL As New MySQL("Mysql")
Dim SQL As String
Dim Flag As Boolean
Dim buf As String
MySQL.Active = True
If MySQL.Active Then
Print "Ok"
Else
Print "NO"
End If
SQL = |INSERT INTO `notice` (`app_name`) VALUES ('павопавргпкоптошщаг')|
MySQL.SQL = SQL
If MySQL.SQLExec() Then
Print "REQUEST: SQL(" & SQL & ") - Seccussfully executed..."
Flag = True
Else
Print "REQUEST: SQL(" & SQL & ") - Fail"
Exit Function
End If
If Flag Then
MsgBox "count" & MySQL.RecordCount
While Not MySQL.isEofRow()
MsgBox MySQL.Field("app_name").Value + " - " + MySQL.Field("id").Value
Call MySQL.NextRow()
Wend
End If
Call MySQL.Disconnect()
Exit Function
eline:
Print Error & " " & Erl
Exit Function
End Function[/CODE]для таких же как я (далеких от этой темы)