RE: recordset values reset tu null after use as an argument in a function call
"Jos Verhoeff" <[email protected]>
| Newsgroups | gmane.comp.db.mysql.odbc |
|---|---|
| Message-ID | <000601c890b9$1c347ad0$549d7070$@nl> |
Hi, The code has been working and for some reason stopped working, but only in some cases, so I thought I'd share it with this list. Would there be anything I can do to narrow it down ? There are a lot of this type of calls in the code. If I do as John suggests, the component (vb dll) will get a lot bigger. As I said it does not make a difference whether the variable is coded in the function as byref or byval. Could it have something to do with the different (stricter) way recent versions of MyODBC handles data types ? The caller sends a recordset value (MySQL data type is varchar) and the called expects a string value. Could that be it ? Jos Verhoeff -----Original Message----- From: Bonnett, John [mailto:[email protected]] Sent: vrijdag 28 maart 2008 5:51 To: [email protected]; [email protected] Subject: RE: recordset values reset tu null after use as an argument in a function call I wouldn't pass rs("fieldname").value as an argument to the function. Grab its value in a local string and pass that. I do agree though that it should not make any difference. John Bonnett -----Original Message----- From: Jos Verhoeff [mailto:[email protected]] Sent: Wednesday, 26 March 2008 10:49 PM To: [email protected] Subject: recordset values reset tu null after use as an argument in a function call Hi, Since I upgraded to MyODBC 3.51.24 (MySQL 5 release running) I have the following problem in a vb dll that has been running for a number of years now. I populate a recordset Function check(S as string) Return true or false End function Function dosomething Dim rs >>Populate rs Dosomething = "" If check(rs("fieldname").value) then dosomething = rs("fieldname").value End if End function At line If y(rs("fieldname").value) then, the value of rs("fieldname") has a value At line X = rs("fieldname").value the value is reset to null The call to function check resets it to null Check itself does nothing with the field value but analyse its contents Whether I do byval S or byref S makes no difference. What does make a difference is the database itself. I have a number of databases, all with the same structure, and for some this happens, for some it does not. With the previous MyODBC versions (3.51.20 I believe) this did not happen, also not with MySQL 4.0 and 4.1 I can check my code and recompile, but I would like to know what I am watching for. Greetings, Jos Verhoeff CERIUM - Internet Technology Beurs - World Trade Center - Suite 273 Beursplein 37 (bezoekadres) Postbus 30006 3001 DA Rotterdam T : 010 2056700 F : 010-2051938 I : <BLOCKED::http://www.cerium.nl/> www.CERIUM.nl Alg. @ : <BLOCKED::mailto:[email protected]> [email protected] -- MySQL ODBC Mailing List For list archives: http://lists.mysql.com/myodbc To unsubscribe: http://lists.mysql.com/[email protected]