Luis Sanches wrote:

Hi,

I've recently made the move over from Access to MySQL.

So far, everything has been fine.
I'm using:
Win2K server (ASP)
WinMySQLadmin 1.4,
MyCC 0.8.4-alpha,
MyODBC 3.51 and
MySQL 3.23.51-nt

First problem: (fixed)
----------------------
I had used some keywords as table names, but SQL in a Nutshell by O'Reilly
put me on the straight track.

Second problem: (also fixed)
----------------------------
Then I had problems using this line: <% If MyRS.recordcount > 0 Then %>...

I discovered that under ASP, the recordcount is "-1", so I worked around
this by using the following line:
<% If MyRS.EOF = "False" Then %>.

All was fine, and exporting data straight from Access2000 into MySQL was
easy.

I then found one bizarre problem:

Third Problem: (Circumvented)
-----------------------------
I could edit any old record set - originally created on Access, but not
newly created ones!


>>Error Type:
>>Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
>>Query-based update failed because the row to update could not be found.


I spent quite some time looking for information on how to fix this, and drew
a blank.
I can display all the info from the new record set, but I can't update it...

..that is until I tried a different way to update it:


>>Old way:


1) Open connection (sql="select * from mytablename where UserID = '1'")

2) MyRS("UserName") = "New Value"

3) MyRS.Update '<-- Error occurred at this line
4) MyRS.Close


>>New way:


1) Open connection with update directly in sql statement:
(sql="UPDATE mytablename SET UserName = 'New Value' WHERE UserID = '1'")


So... here's my questions to you knowledgeable lot:

a) Why did the second method work, and not the first? - is this a MyODBC
bug?
b) Why is this only happening to NEW rows in the database? - is it a MyODBC
bug?
c) could I gain/fix anything by changing over to MySQL 4 ?
d) how do YOU normally update MySQL records from within ASP?

Many thanks for any insight. As I said, I've made it work, so I'm not too
troubled, but I would like to code things in the 'standard' way.

You just need a correct OPTION value passed to the connect string or setting them in the DSN configuration.

Check the following code, which has .update, .addnew and .delete methods from ADO:
http://www.mysql.com/products/myodbc/manual.html#MyODBC_With_VB

--
Regards, Venu
--
For technical support contracts, go to https://order.mysql.com
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Venu <[EMAIL PROTECTED]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Developer
/_/ /_/\_, /___/\___\_\___/ Palo Alto, CA-94306
<___/ www.mysql.com USA




---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to