mysql:9597
From: bon <bon <bon@xxxxxxxxxx>>
Date: Fri, 11 Jun 2004 11:25:01 +0900
Subject: [mysql 09597] 多段階の OLE DB の操作でエラー
bonです。
OS:Windows 2000 Server
MySQL:mysql-4.0.18-win.zip
ODBC:MyODBC-3.51.06.exe
を使用しています。
ODBCのオプションは
Don't optimize column width
Return matching rows
にチェックしています。
以下のテーブルとデータを使用し、
-----ここから-----
DROP TABLE IF EXISTS testtbl;
CREATE TABLE testtbl (
did varchar(16) NOT NULL default '',
msg text,
PRIMARY KEY (did)
) TYPE=MyISAM;
INSERT INTO testtbl VALUES ('1',NULL);
INSERT INTO testtbl VALUES ('2','');
INSERT INTO testtbl VALUES ('3','msg');
-----ここまで-----
データを放り込んだ結果は
mysql> desc testtbl;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| did | varchar(16) | | PRI | | |
| msg | text | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.02 sec)
mysql> select * from testtbl;
+-----+------+
| did | msg |
+-----+------+
| 1 | NULL |
| 2 | |
| 3 | msg |
+-----+------+
3 rows in set (0.00 sec)
です。
そして、以下を拡張子vbsで保存し
-----ここから-----
Const C_ActConn = "dsn=hoge;uid=hogeuser;pwd=hogepass"
MsgBox ChgData(1),,"1"
MsgBox ChgData(2),,"2"
MsgBox ChgData(3),,"3"
Function ChgData(a_did)
ChgData = "Not Found"
On Error Resume Next
Set rs = CreateObject("ADODB.Recordset")
strSql = "select * from testtbl where did='" & a_did & "'"
rs.Open strSql, C_ActConn
If rs.EOF <> True Then
strWork = rs.Fields("msg")
If Err Then
ChgData = "ERR=" & strWork
Else
ChgData = "OK=" & strWork
End If
End If
rs.Close
Set rs = Nothing
End Function
-----ここまで-----
実行すると、
did=2の時、つまりmsgが''の時にERRとなります。
エラーの内容は
多段階の OLE DB の操作でエラーが発生しました。
各 OLE DB の状態の値をチェックしてください。作業は終了しませんでした。
です。
http://dev.mysql.com/doc/mysql/ja/BLOB.html
にはtextに空文字はいれてはいけないみたいな記述は見つかりません。
これは何が悪いのでしょうか?
On Error Resume Nextして
Errなら空文字とみなすのが正しい処理なのでしょうか?
よろしくお願いします。
-----------------
bon@xxxxxxxxxx
-> 9597 2004-06-11 11:25 [bon <bon@xxxxxxxxxx>] 多段階の OLE DB の操作でエラー 9629 2004-06-14 04:56 ┗[bon <bon@xxxxxxxxxx>]