no no avete ragionissima infatti mi serve dopo una insert
ho fatto una insert con dreamweaver
come faccio a richiamare il valore?
ho provato numes=MM_editCmd.CommandText ("ident")
e numes=MM_editCmd("ident")
ma dà errore
questo è il codice della pagina asp
Codice PHP:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
If (CStr(Request("MM_insert")) = "form1") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd, numes
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_provo_STRING
MM_editCmd.CommandText = "INSERT INTO messaggi (mess) VALUES (?)"
MM_editCmd.CommandText = "SELECT @@IDENTITY as ident FROM messaggi"
numes=MM_editCmd.ActiveConnection("ident")
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 255, Request.Form("mess")) ' adVarWChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "?n="&numes
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>a</title>
</head>
<body>
<form action="<%=MM_editAction%>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Mess:</td>
<td><input type="text" name="mess" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"></td>
<td><input type="submit" value="Inserisci record" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
</p>
numes= <%=numes%>
</body>
</html>