RE: ADO Error "800a01fb"
am 30.12.2002 00:06:04 von VenuHi !!
>
> CREATE TABLE mytable (
> pkey int(11) NOT NULL auto_increment,
> data varchar(255) NOT NULL default '',
> image blob,
> PRIMARY KEY (pkey)
> ) TYPE=MyISAM;
>
> about the question : <<< What version of 3.23 that is
> working for you ?
> >>>My answer is : <<< mysql 3.23.54a + myODBC 3.51.5 >>>my
> vb6 Script :
>> How to repeat:
> strSQL = "DRIVER={MySQL ODBC 3.51
> Driver};SERVER=localhost;DATABASE=test;USER=root;PASSWORD=ro ot
> ;OPTION=35;"
> Set Cn1 = CreateObject("ADODB.Connection") Cn1.Open strSQL
> strSQL1 = "select * from mytable where pkey = " & 1 Set rs2 =
> CreateObject("ADODB.Recordset") rs2.Open strSQL1, Cn1, 1, 3
> If Not rs2.EOF Then rs2("data").Value = Now
> rs2.Update
> End If rs2.Close Cn1.Close Set
> rs2 = Nothing
> Set Cn1 = Nothing
I just tried the same and a similar example with MySQL 3.23, 4.0.7 and
4.1, and with all of them, it works fine at my end. I used ADO 2.7;
Here is my test snippet:
Private Sub Err_800a01fb_Click()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim fld As ADODB.Field
Dim sql As String
Dim id As Integer
'Connect to MySQL Server
Set conn = New ADODB.Connection
conn.ConnectionString = "Driver={MySQL ODBC 3.51 Driver};" _
& "SERVER=localhost;DATABASE=test;USER=venu;" _
& "PASSWORD=venu;OPTION=3;"
'conn.ConnectionString = "DSN=myodbc3;"
conn.Open
'create table
conn.Execute "DROP TABLE IF EXISTS my_ado"
conn.Execute "CREATE TABLE my_ado(pkey int(11) NOT NULL auto_increment,"
_
& "data varchar(255) NOT NULL default '', " _
& " image blob, primary key(pkey) )TYPE=MyISAM"
'direct insert
conn.Execute "INSERT INTO my_ado(data) values('venu'),('mysql')"
Set rs = New ADODB.Recordset
'rs.CursorLocation = adUseServer
rs.CursorLocation = adUseClient
'fetch back..
rs.Open "select * from my_ado", conn, 1, 3
rs.MoveFirst
'Do
Debug.Print String(15, "-") & "RESULT - BEFORE UPDATE " & String(15,
"-")
For Each fld In rs.Fields
Debug.Print fld.Name,
Next
Debug.Print
Debug.Print String(35, "-")
Do Until rs.EOF
For Each fld In rs.Fields
Debug.Print fld.Value,
Next
rs.MoveNext
Debug.Print
Loop
'Loop Until rs.EOF = False
Debug.Print "Total records: " & rs.RecordCount
Debug.Print
rs.Close
'rs insert
id = 1
rs.Open "select * from my_ado where pkey = " & id, conn, 1, 3
rs!Data = "update-1"
rs.Update
rs.Close
'rs update second time..
id = 2
rs.Open "SELECT * FROM my_ado where pkey = " & id, conn, 1, 3
rs!Data = "update-2"
rs.Update
rs.Close
'fetch back..
rs.Open "SELECT * FROM my_ado"
rs.MoveFirst
'Do
Debug.Print String(15, "-") & "RESULT - AFTER UPDATE" & String(15,
"-")
For Each fld In rs.Fields
Debug.Print fld.Name,
Next
Debug.Print
Debug.Print String(35, "-")
Do Until rs.EOF
For Each fld In rs.Fields
Debug.Print fld.Value,
Next
rs.MoveNext
Debug.Print
Loop
'Loop Until rs.EOF = False
Debug.Print "Total records: " & rs.RecordCount
Debug.Print
rs.Close
conn.Close
Set conn = Nothing
Set rs = Nothing
End Sub
And here is the output..
---------------RESULT - BEFORE UPDATE ---------------
pkey data image
-----------------------------------
1 venu Null
2 mysql Null
Total records: 2
---------------RESULT - AFTER UPDATE---------------
pkey data image
-----------------------------------
1 update-1 Null
2 update-2 Null
Total records: 2
Let me know if you have any questions.
Regards, Venu
--
For technical support contracts, go to https://order.mysql.com
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Venu
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Developer
/_/ /_/\_, /___/\___\_\___/ Palo Alto, CA-94306
<___/ www.mysql.com USA
------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/products/myodbc/manual_toc.html (the manual)
http://lists.mysql.com/ (the list archive)
To unsubscribe, e-mail
To unsubscribe from Yahoo! Groups version, e-mail myodbc-unsubscribe@yahoogroups.com