1 messaggio dal 10 febbraio 2009
Ciao sono nuova del forum. Avrei questo problema da sottoporre. Ho una galleria fotografiva in asp. nel pannello amministratore inserisco le foto, la descrizione e fin qui tutto bene. Se però cerco di modificare quanto scritto e quindi apro la relativa pagina per effettuare le modifiche ottengo questo errore:

Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: ""]' /cgi-bin/galleria/inc_detail.asp, line 189:
preciso che la riga 189 è questa; imgPercent = (imgFixWidth/imgWidth)
questo è il codice della pagina:

<!--#include file="../Connections/connAdmin.asp" -->
<!--#include file="../ScriptLibrary/incPUAddOn.asp" -->
<%
Dim rsPicEdit__MMColParam
rsPicEdit__MMColParam = "1"
if (Request.QueryString("iPic") <> "") then rsPicEdit__MMColParam = Request.QueryString("iPic")
%>
<%
set rsPicEdit = Server.CreateObject("ADODB.Recordset")
rsPicEdit.ActiveConnection = MM_connDUgallery_STRING
rsPicEdit.Source = "SELECT * FROM PICTURES WHERE PIC_ID = " + Replace(rsPicEdit__MMColParam, "'", "''") + ""
rsPicEdit.CursorType = 0
rsPicEdit.CursorLocation = 2
rsPicEdit.LockType = 3
rsPicEdit.Open()
rsPicEdit_numRows = 0
%>
<%
' *** Edit Operations: declare variables
MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables
If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then
MM_editConnection = MM_connDUgallery_STRING
MM_editTable = "PICTURES"
MM_editColumn = "PIC_ID"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_editRedirectUrl = "pictures.asp"
MM_fieldsStr = "PIC_TYPE|value|PIC_NAME|value|PIC_HEIGHT|value|PI C_WIDTH|value|PIC_DATED|value|PIC_APPROVED|value|P IC_DESCRIPTION|value"
MM_columnsStr = "PIC_TYPE|none,none,NULL|PIC_NAME|',none,''|PIC_HE IGHT|',none,''|PIC_WIDTH|',none,''|PIC_DATED|',non e,NULL|PIC_APPROVED|none,none,NULL|PIC_DESCRIPTION |',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")

' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Delete Record: declare variables
if (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then
MM_editConnection = MM_connDUgallery_STRING
MM_editTable = "PICTURES"
MM_editColumn = "PIC_ID"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_editRedirectUrl = "pictures.asp"
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
%>
<%
' *** Delete File Before Delete Record 1.6.0
If (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then
Dim DF_filesStr, DF_path, DF_suffix
DF_filesStr = "PIC_IMAGE"
DF_path = "../images"
DF_suffix = "_small"
DeleteFileBeforeRecord DF_filesStr,DF_path,MM_editConnection,MM_editTable ,MM_editColumn,MM_recordId,DF_suffix
end if
%>
<%
' *** Update Record: construct a sql update statement and execute it
If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then
' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),",")
Delim = MM_typeArray(0)
If (Delim = "none") Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none") Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none") Then EmptyVal = ""
If (FormVal = "") Then
FormVal = EmptyVal
Else
If (AltVal <> "") Then
FormVal = AltVal
ElseIf (Delim = "'") Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''") & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(i) & " = " & FormVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
' *** Delete Record: construct a sql delete statement and execute it
If (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then
' create the sql delete statement
MM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordId
If (Not MM_abortEdit) Then
' execute the delete
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
set rsCat = Server.CreateObject("ADODB.Recordset")
rsCat.ActiveConnection = MM_connDUgallery_STRING
rsCat.Source = "SELECT * FROM TYPES ORDER BY TYPE_NAME ASC"
rsCat.CursorType = 0
rsCat.CursorLocation = 2
rsCat.LockType = 3
rsCat.Open()
rsCat_numRows = 0
%>
<%
Dim imgWidth, imgHeight, imgPercent, imgFixWidth, imgFixHeight
imgWidth = rsPicEdit.Fields.Item("PIC_WIDTH").Value
imgHeight = rsPicEdit.Fields.Item("PIC_HEIGHT").Value
imgFixWidth = 580
imgPercent = (imgFixWidth/imgWidth)
imgFixHeight= (imgHeight*imgPercent)
%>
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d )&&d.all) x=d.all ; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i] ;
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') {
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
<head>
<link href="../assets/DUgallery.css" rel="stylesheet" type="text/css">
</head>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr>

<td align="left" valign="top">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td align="left" valign="top">
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#000000">

<tr>
<td align="left" valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr class="generalTextBold" align="center">
<form method="POST" action="<%=MM_editAction%>" name="form1">
<td valign="middle" colspan="2"><table align="center" cellpadding="2" cellspacing="2" class="textBold">
<tr align="center" valign="middle">
<td nowrap colspan="2">UPDATING <%= UCase((rsPicEdit.Fields.Item("PIC_NAME").Value)) %></td>
</tr>
<tr valign="middle">
<td nowrap align="right">CAT:</td>
<td><select name="PIC_TYPE" class="form">
<%
While (NOT rsCat.EOF)
%>
<option value="<%=(rsCat.Fields.Item("TYPE_ID").Value)%>"<%if (CStr(rsCat.Fields.Item("TYPE_ID").Value) = CStr(rsPicEdit.Fields.Item("PIC_TYPE").Value)) then Response.Write("SELECTED") : Response.Write("")%>><%=(rsCat.Fields.Item("TYPE_NAME").Value)%></option>
<%
rsCat.MoveNext()
Wend
If (rsCat.CursorType > 0) Then
rsCat.MoveFirst
Else
rsCat.Requery
End If
%>
</select></td>
</tr>
<tr valign="middle">
<td nowrap align="right">TITOLO:</td>
<td><input type="text" name="PIC_NAME" value="<%=(rsPicEdit.Fields.Item("PIC_NAME").Value)%>" size="25" class="form" maxlength="256">
&nbsp;</td>
</tr>
<tr valign="middle">
<td nowrap align="right">ALTEZZA:</td>
<td><input type="text" name="PIC_HEIGHT" value="<%=(rsPicEdit.Fields.Item("PIC_HEIGHT").Value)%>" size="5" class="form" maxlength="3">
</td>
</tr>
<tr valign="middle">
<td nowrap align="right">LARGHEZZA:</td>
<td><input type="text" name="PIC_WIDTH" value="<%=(rsPicEdit.Fields.Item("PIC_WIDTH").Value)%>" size="5" class="form" maxlength="3">
</td>
</tr>
<tr valign="middle">
<td nowrap align="right">DATA:</td>
<td><input type="text" name="PIC_DATED" value="<%=(rsPicEdit.Fields.Item("PIC_DATED").Value)%>" size="15" class="form" maxlength="15">
</td>
</tr>
<tr valign="middle">
<td nowrap align="right">APPROVED:</td>
<td><input type="text" name="PIC_APPROVED" value="<%=(rsPicEdit.Fields.Item("PIC_APPROVED").Value) %>" size="2" class="form" maxlength="1">
<font color="#999999">(Scrivi 1 per Yes, 0 per No)</font></td>
</tr>
<tr valign="middle">
<td nowrap align="right" valign="top">DESC:</td>
<td><textarea name="PIC_DESCRIPTION" cols="40" rows="5" class="form"><%=(rsPicEdit.Fields.Item("PIC_DESCRIPTION").Value )%></textarea>
</td>
</tr>
<tr valign="middle" align="center">
<td nowrap colspan="2"><input type="submit" value="Aggiorna" onClick="MM_validateForm('PIC_NAME','','R','PIC_HEIGHT','' ,'RisNum','PIC_WIDTH','','RisNum','PIC_DATED','',' R','PIC_APPROVED','','RisNum','PIC_DESCRIPTION','' ,'R');return document.MM_returnValue" class="form">
</td>
</tr>
<tr valign="middle" align="center">
<td nowrap colspan="2">&nbsp;</td>
</tr>
</table><input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="MM_recordId" value="<%= rsPicEdit.Fields.Item("PIC_ID").Value %>">
</td>
</form>
</tr>
<tr>
<form name="delete" method="POST" action="<%=MM_editAction%>">
<td align="center" valign="top" colspan="2"><input type="submit" name="Submit" value="Delete This Picture" class="form">
<input type="hidden" name="MM_delete" value="delete">
<input type="hidden" name="MM_recordId" value="<%= rsPicEdit.Fields.Item("PIC_ID").Value %>">
</td>
</form>
</tr>
<tr>
<td align="center" valign="top" colspan="2"><img src="../images/<%=(rsPicEdit.Fields.Item("PIC_IMAGE").Value)%>" width = "<%= imgFixWidth %>" height = "<%= imgFixHeight %>">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>

<%
rsPicEdit.Close()
%>
<%
rsCat.Close()
%>

Ciao e grazie Cinzia
272 messaggi dal 13 luglio 2005
Ciao,
l'errore "Type mismatch" in italiano viene tradotto in "Tipo non corrispondente" ... ovvero: stai operando con variabili di tipo diverso e non compatibile.
In poche parole probabilmente stai assegnando ad una variabile numerica un valore stringa (come se scrivessi: Num = "abc" dove la variabile "Num" è una variabile integer). O stai facendo delle operazioni (divisione, moltiplicazione) tra numero e stringa.

Nel tuo caso, quindi, dovresti controllare se le variabili "imgFixWidth" e "imgWidth" sono effettivamente dei numeri, magari stampandone il valore poco prima dell'errore.

Fammi sapere, ciao.

Umb

Torna al forum | Feed RSS

ASPItalia.com non è responsabile per il contenuto dei messaggi presenti su questo servizio, non avendo nessun controllo sui messaggi postati nei propri forum, che rappresentano l'espressione del pensiero degli autori.