ODBC Driver Error when I try to write in a MysQL DB using ASP.3.0 Code.RSS

3 replies

Last post Jun 11, 2004 12:40 PM by tomkmvp

  • ODBC Driver Error when I try to write in a MysQL DB using ASP.3.0 Code.

    Jun 05, 2004 02:08 PM|alrodri|LINK

    Hello Folks, I'm trying to interact ASP 3.0 & MySQL 4.0, having the following codes: 37-set tblpruebas = Server.CreateObject("ADODB.RecordSet") 38- 39-strSQL="SELECT * FROM tblpruebas ORDER BY PRID" 40-tblpruebas.Open strSQL, cnMySQL, adOpenDynamic, adLockOptimistic,adCmdText 41- 42-if tblpruebas.EOF then 43- tblpruebas.AddNew 44- tblpruebas("PRID")=1 45-else 46- tblpruebas.MoveLast 47- vPRID=tblpruebas("PRID") 48- tblpruebas.AddNew 49- tblpruebas("PRID")=vPRID+1 50-end if 51- 52-tblpruebas("PRNOM")=vNom 53-tblpruebas("PRMAIL")=vMail 54- 55-tblpruebas("PRCODE")=vCode 56-tblpruebas("PRDATE")=Date() 57- 58-tblpruebas.UpDate 59-tblpruebas.Close 60-cnMySql.Close The table “tblpruebas” has the following fields: PRID----Type: INT PRNOM---Type: VARCHAR(50) PRMAIL--Type: VARCHAR(50) PRCODE--Type: INT PRDATE--Type: DATE But I receive the following error: Microsoft OLE DB Provider for ODBC Drivers error '80040e21' Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. /p/index.asp, line 52 This error could be cause of: - Incompatible field names from written codes with the real field name that the table has: I’m sure that is OK - Incompatible field data type with the data I’m trying to write. It does not exist because I pretend to introduce “Jim” in a VARCHAR(50) MySQL data type. - The string I’m trying to introduce is longer than the configured length of the VARCHAR field. It doesn’t happen. If I apply a commentary to 52 and 53 lines (Those of the string), everything works perfect. The exception is that I don’t save “Nombre” nether “eMail” fields. I mean that the code goes OK with the “AddNew” method, but it just works correctly with “INT” and “DATE” fields. I have been testing, getting the same error, with the following ways: 52-tblpruebas("PRNOM")="Juan" //Writing directly the string ="'Juan'" ="'"&vNom&"'" =trim(request.form("vNom")) I have been changed VARCHAR field by MEDIUMTEXT ones, but I get a new error in line 58 (UpDate method) Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Driver Manager] Invalid string or buffer length /p/index.asp, line 58 I have could do it correctly using the INSERT sentence with the PHPMyAdmin. When I read the fields data it works OK Thanking you in advance,
  • Re: ODBC Driver Error when I try to write in a MysQL DB using ASP.3.0 Code.

    Jun 11, 2004 01:29 AM|Ken Schaefer|LINK

    The ADO Connection object has an Errors collection. Iterate through the errors collection and Response.Write() the Error description for each error. Cheers Ken
  • Re: ODBC Driver Error when I try to write in a MysQL DB using ASP.3.0 Code.

    Jun 11, 2004 01:31 AM|Ken Schaefer|LINK

  • Re: ODBC Driver Error when I try to write in a MysQL DB using ASP.3.0 Code.

    Jun 11, 2004 10:04 AM|tomkmvp|LINK

    See also: http://www.aspfaq.com/search.asp?q=80040e21&type=ALL&category=0&numDays=0&order=2 http://www.aspfaq.com/search.asp?q=80004005&type=ALL&category=0&numDays=0&order=2