Ciao a tutti,
Spero che qualcuno possa aiutarmi, una pagina asp del sito che sto costruendo, si blocca con questo errore:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14' .
Sò cosa genera l'errore, praticamente nell'INSERT viene inserito un parametro come testo, quindi tra apici, mentre nel db è un campo Data,
saprei come fare per modificarlo se il modulo INSERT lo avessi creato io, ma è un sito realizzato da programmatori americani e non sò dove mettere le mani.
Per un esempio potete vedere voi stessi andando a questo link:
cosvical.it
Provando a comprare qualcosa, entrare come user: test, pass: test e andare avanti fino a quando s'incontra l'errore.
Questo è il codice che interessa:
Function cwCleanString(str)
cwCleanString = Replace(str,"'","''")
End Function 'cwCleanString
Function cwBoolSQL(str)
Dim sqlTrue, sqlFalse
Select Case LCase(dbType)
Case "access"
sqlTrue = "True"
sqlFalse = "False"
Case "sql"
sqlTrue = 1
sqlFalse = 0
End Select
cwBoolSQL = sqlFalse
If CBool(str) = True Then cwBoolSQL = sqlTrue
End Function 'cwCleanString
Function cwOpenQuery(strSQL, strconn)
Set cwOpenQuery = Server.CreateObject("ADODB.Recordset")
With cwOpenQuery
.ActiveConnection = MM_conncartweaver_STRING
.Source = strSQL
.CursorType = 3
.CursorLocation = 2
.LockType = 1
.Open()
End With
End Function 'cwOpenQuery
Function cwExecuteQuery(strSQL, strconn, strReturnID)
If NOT IsNull(strReturnID) Then
'We want an ID returned, so it's assumed that we're doing an insert.
Dim arIDData : arIDData = Split(strReturnID,",")
Dim x, rsInsert
Set rsInsert = Server.CreateObject("ADODB.Recordset")
With rsInsert
.ActiveConnection = MM_conncartweaver_STRING
.CursorType = 1
.LockType = 3
.Source = arIDData(0)
.Open
.AddNew
End With
Dim arInserts : arInserts = Split(strSQL,"||")
For x = 0 To UBound(arInserts) Step 2
rsInsert(arInserts(x)) = arInserts(x + 1)
Next
rsInsert.Update
cwExecuteQuery = rsInsert(arIDData(1))
cwCloseRecordset(rsInsert)
Else 'We don't want an ID, so just run the command.
Response.Write(strSQL & "<hr />")
Dim cn,cmdExwcute
Set cn = Server.CreateObject( "ADODB.Connection")
cn.open MM_conncartweaver_STRING
Set cmdExecute = Server.CreateObject("ADODB.Command")
With cmdExecute
.ActiveConnection = cn
.CommandText = strSql
.Execute()
.ActiveConnection.Close
End With
Set cmdExecute = Nothing
End If 'NOT IsNull(strReturnID)
End Function 'cwExecuteQuery
Sub cwCloseRecordset(rs)
If IsObject(rs) Then rs.Close() : Set rs = Nothing
End Sub 'cwCloseRecordset
Function cwMakeSQLDate(strDate,bolTime)
If IsDate(strDate) Then
strDate = CDate(strDate)
cwMakeSQLDate = Right("0" & Day(strDate),2) & "/" & Right("0" & Month(strDate),2) & "/" & Year(strDate)
If bolTime Then
cwMakeSQLDate = cwMakeSQLDate & " " & Hour(strDate) &_
":" & Minute(strDate) &_
":" & Second(strDate)
End If
End If
Select Case LCase(dbtype)
Case "access"
cwMakeSQLDate = "#" & cwMakeSQLDate & "#"
Case "sql"
cwMakeSQLDate = "'" & cwMakeSQLDate & "'"
Case Else
cwMakeSQLDate = "'" & cwMakeSQLDate & "'"
End Select
End Function
Function cwSqlParam(strTestValue, strDefaultValue, strType)
cwSqlParam = cwCleanString(cwParam(strTestValue,strDefaultValue ))
Select Case strType
Case "string"
If cwSqlParam <> "Null" Then cwSqlParam = "'" & cwSqlParam & "'"
Case "numeric"
cwSqlParam = CInt(cwSQLParam)
Case "date"
cwSqlParam = CDate(cwSqlParam)
If cwSqlParam <> "Null" Then cwSqlParam = "'" & cwSqlParam & "'"
End Select
End Function
*****************************
Mi date una mano?![]()