Buenas tardes.
Tengo una aplicacion ASP la cual actualmente se conecta con los siguintes manejadores de bases de datos:
-Access
-SQLServer
-Cache
la aplicacion funciona correctamente con cualquiera de estos manejadores, en mi intento por utilizar MySQL obtengo un error al cual aun no he podido solucionar.
Código:
Tipo de error:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[MySQL][MyODBC 5.00.11][MySQL] 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
/em/BackOffice/dbFunctions.asp, línea 21
la parte del codigo de dicha aplicacion es el siguinte
archivo include con conexion a la db CONNECTION.asp
Código:
Dim MM_CONNECTION_STRING
set MM_CONNECTION_STRING = Server.CreateObject("ADODB.Connection")
'MySQL ODBC DRIVER 5.0 / FUNCIONA CORRECTAMENTE
MM_CONNECTION_STRING ="Driver={MySQL Connector/ODBC v5};Server=127.0.0.1;Database=merchant;UID=mysql;PWD=123456;Port=3306;Option=16427"
fragmento archivo include funciones de base de datos dbFunctions.asp
Código:
sub openDb()
if varType(connTemp)=0 or varType(connTemp)=1 then
' create the connection
set connTemp = server.createObject("adodb.connection")
connTemp.Open MM_CONNECTION_STRING
end if
end sub
sub getFromDatabase(mySQLs, rsTemp, scriptName)
mySQLs="`"&mySQLs&"`"
call openDb()
set rsTemp = server.createObject("adodb.recordset")
' set locktype
rsTemp.lockType = 1'adLockReadOnly
' set the cursor
rsTemp.cursorType = adOpenForwardOnly
rsTemp.open mySQLs, connTemp
end sub
fragmento del codigo de index.asp donde se genera el error al tratar de ejecutar el query
SELECT Count(PRODUCT_TO_MERCHANT_ID_PRODUCT) AS howManyHome FROM MERCHANT_CATEGORY INNER JOIN MERCHANT_PRODUCT_TO_MERCHANT ON MERCHANT_CATEGORY.ID_CATEGORY = MERCHANT_PRODUCT_TO_MERCHANT.PRODUCT_TO_MERCHANT_I D_CATEGORY WHERE MERCHANT_PRODUCT_TO_MERCHANT.PRODUCT_TO_MERCHANT_S H=1 AND MERCHANT_PRODUCT_TO_MERCHANT.PRODUCT_TO_MERCHANT_S TATUS=1 AND MERCHANT_CATEGORY.CATEGORY_ID_MERCHANT=2 AND MERCHANT_CATEGORY.CATEGORY_ACTIVE=1
el cual ya lo probe en MySQL Query browser
Código:
<!--#include file="CONNECTION.asp" -->
<!--#include file="dbFunctions.asp"-->
<%
dim connTemp, rsTemp, rsTemp3, pItemsShown, pMaxPopularity, arrCounter, pIdCustomer, pIdCustomerType, howManyHome, mySQL, pDefaultLanguage, pStoreFrontDemoMode, pCurrencySign, pDecimalSign, pMoneyDontRound, pCompany, pCompanyLogo, pHeaderKeywords, pAuctions, pListBestSellers, pNewsLetter, pPriceList, pStoreNews, pOneStepCheckout, pAffiliatesStoreFront, pShowStockView, pIdProductVip, pLastChanceListing, pAllowNewCustomer, pListProductsByLetter, pRunInstallationWizard, pIdProduct, pDescription, pDetails, pDetailsVip, pImageUrlVip, pLanguage, pCustomerName, pHeaderCartItems, pHeaderCartSubtotal, pItemCounter, f, h
' get how many products are marked as showInHome
mySQL="SELECT Count(PRODUCT_TO_MERCHANT_ID_PRODUCT) AS howManyHome FROM MERCHANT_CATEGORY INNER JOIN MERCHANT_PRODUCT_TO_MERCHANT ON MERCHANT_CATEGORY.ID_CATEGORY = MERCHANT_PRODUCT_TO_MERCHANT.PRODUCT_TO_MERCHANT_ID_CATEGORY WHERE MERCHANT_PRODUCT_TO_MERCHANT.PRODUCT_TO_MERCHANT_SH=1 AND MERCHANT_PRODUCT_TO_MERCHANT.PRODUCT_TO_MERCHANT_STATUS=1 AND MERCHANT_CATEGORY.CATEGORY_ID_MERCHANT="&session("idStore")&" AND MERCHANT_CATEGORY.CATEGORY_ACTIVE=1"
call getFromDatabase (mySql, rsTemp3, "dynamic_index")
Por lo que he leido el error es causado por sintaxis, si alguin sabe como solucionar este problema se los agradecere
saludos cordiales
Pablo Nieto