386 messaggi dal 25 maggio 2001
Response object error 'ASP 0156 : 80004005'

Header Error

/GestioneDatabase/GestioneDatabase.asp, line 408

The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.

Che errore è?Come posso correggerlo?

La line 408 è questa:
Response.Redirect "GestioneDatabase.asp?Tabella=" & TabellaDaVisualizzare & "&TOP=" & clng(Request.QueryString ("TOP"))
case "SalvaModifiche"


Grazie



22 messaggi dal 28 maggio 2001
Secondo me prima di quella riga fai dei Response.Write! Non farli e il Redirect funzionerà.
Ciao

386 messaggi dal 25 maggio 2001
Questo è lo scipt completo,mi potete cosa devo fare per eliminare l'errore che ho descritto sopra?Grazie.
Si svolge tutto in una pagina
------------inizio pagina-----------
<html>
<head>
<title>Gestione Database</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<%@ Language=VBScript %>
<%
Function Apex(sData,newData)
' Return string with single quotes doubledDim iLast As Integer
If Len(sData) = 0 Then
NewData = ""
Exit Function
END IF
iLast = InStr(sData, "'")
While iLast
sPart = sPart & left(sData, iLast - 1) & "'" & "'"
sData = Right(sData, Len(sData) - iLast)
iLast = InStr(sData, "'")
Wend
sData = sPart & sData
newData = Trim(sData)
End Function

'Create object. In this case Connection to a database
Set Conn = Server.CreateObject("ADODB.Connection")

'Select provider
Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
'Select data source.
'Server.MapPath function is equivalent to app.path function of VB
'It returns the directory in which the script is present
Conn.ConnectionString = "Data Source=" & Server.MapPath ("database.mdb")
'Open the connection
Conn.Open

'Create recordset
Set Rs = Server.CreateObject("ADODB.Recordset")
Set mTable = Server.CreateObject("ADOX.Catalog")
set mNew = Server.CreateObject("ADOX.Table")
'Open recordset with the connection which we have created earlier
'you must be familiar with SELECT statement ,
'If not check my VB tutorial section.
mtable.ActiveConnection = Conn.ConnectionString
TabellaDaVisualizzare = Request.querystring("Tabella")
if TabellaDaVisualizzare = "" then
TabellaDaVisualizzare = Request.form("Tabella")
end if
SQL =Request.querystring("sSQL")

%>
<body bgcolor="#000080">
<%
if TabellaDaVisualizzare = "" then
%>
<form method="POST" action="GestioneDatabase.asp?TOP=10" id=form2 name=form2>
<font face="Verdana, Arial, Helvetica, sans-serif" size="-1" color="#FFFFFF">
Tabella
</font>

<select name="Tabella" size="1">
<%
i=0
while i < mtable.Tables.Count
if mTable.Tables(i).type = "TABLE" then
%>
<option value=<%= mTable.Tables(i).name%> selected> <%
Response.Write mTable.Tables(i).name
%> </option>
<%
end if
i=i+1
wend
%>
</select>
<br>
<br>
<input type="submit" value="Visualizza" name="Visualizza">
</form>
<%
'Deinitialize the Connection and Recordset
end if
if TabellaDaVisualizzare <> "" then
if Request.querystring("Action") = "" Then
Rs.Open "SELECT TOP " & Request.QueryString ("TOP") & " * from " & TabellaDaVisualizzare, Conn, 1,3
set mNew = mtable.tables(TabellaDaVisualizzare)
%>

<table width="98%" border="1">
<tr>
<td colspan=<%response.write mnew.columns.count+2%>>
<div align="center">
<font face="Verdana, Arial, Helvetica, sans-serif" size="+1" color="#FFFFFF">
<b>
<%
response.write "Gestione Tabella " & mNew.name
%>
</b>
</font>
</div>
</td>
</tr>
<tr>
<td> 

</td>
<td> 

</td>
<%
i=0
while i < mNew.columns.count
%>
<td>
<div align="center">
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1" color="#FFFFFF">
<%
response.write mNew.columns(i).name
%>
</font></p>
</div>
</td>
<%
i=i+1
wend
%>
</tr>
<%
t=0
lTop = clng(Request.QueryString("TOP")) - 9
t =1
while not rs.EOF and t < ltop
t=t+1
rs.MoveNext
wend
while not rs.eof
i=0
sWhere = ""
if mNew.Indexes.count > 0 then
while i < mNew.indexes(0).columns.count
if swhere = "" then
sWhere = "WHERE " & mnew.columns(mNew.indexes(0).columns(i).name).name & " = "
else
sWhere = sWhere & " AND " & mnew.columns(mNew.indexes(0).columns(i).name).name & " = "
end if
select case mnew.columns(mNew.indexes(0).columns(i).name).type
case 11,3
sWhere = swhere & rs(mNew.indexes(0).columns(i).name)
case 202,203
apex rs(mNew.indexes(0).columns(i).name),sString
sWhere = swhere & "'" & sString & "'"
case 7
sWhere = swhere & "#" & rs(mNew.indexes(0).columns(i).name) & "#"
end select
i=i+1
wend
else
while i < mNew.columns.count
if swhere = "" then
sWhere = "WHERE " & mnew.columns(i).name & " = "
else
sWhere = sWhere & " AND " & mnew.columns(i).name & " = "
end if
select case mnew.columns(i).type
case 11,3
sWhere = swhere & rs(mnew.columns(i).name)
case 202,203
apex rs(mnew.columns(i).name),sString
sWhere = swhere & "'" & sString & "'"
case 7
sWhere = swhere & "#" & rs(mnew.columns(i).name) & "#"
end select
i=i+1
wend
end if
%>

<tr>

<td>
<div align="center">
<a href=<%= "GestioneDatabase.asp?Tabella="& TabellaDaVisualizzare & "&Action=Aggiorna&Query=" & server.URLEncode(swhere)& "&TOP=" & clng(Request.QueryString ("TOP"))%>><img src="Immagini/prop.gif" width="18" height="16" border="0" alt=Aggiorna></a>
</div>
</td>
<td>
<div align="center">
<a href=<%= "GestioneDatabase.asp?Tabella="& TabellaDaVisualizzare & "&Action=Cancella&Query=" & server.URLEncode("DELETE * FROM " & TabellaDaVisualizzare & " " & swhere) & "&TOP=" & clng(Request.QueryString ("TOP"))%>><img src="Immagini/delx.gif" width="18" height="16" border="0" alt=Cancella></a>
</div>
</td>
<%
i=0
while i < mNew.columns.count
%>
<td>
<font face="Verdana, Arial, Helvetica, sans-serif" size="-1" color="#FFFFFF">
 
<%= rs(mNew.columns(i).name)%>
</font>
</td>

<%
i=i+1
wend
%>
</tr>
<%
rs.movenext
t=t+1
wend
%>
</table>

<table width=98 border=0 height=35>
<tr>

<td align=center height="45" valign="bottom">
<form method="POST" action=<%= "GestioneDatabase.asp?Tabella="& TabellaDaVisualizzare & "&Action=Aggiungi" & "&TOP=" & clng(Request.QueryString ("TOP"))%> id=form3 name=form3>
<input type="submit" value="Aggiungi" name="B1">
</form>
</td>
<td align=center height="45" valign="top">
<%
if (ltop +9) = rs.RecordCount then
%>
dddd<a href=<%= "GestioneDatabase.asp?Tabella="& TabellaDaVisualizzare & "&TOP=" & clng(Request.QueryString ("TOP"))+5 %>><img src="Immagini/Forward_Color.gif" width=32 height=29 border="0" alt="Successivi 10" align=middle></a>
<%
end if
%>
</td>
</tr>
</table>
<%
else
select case Request.querystring("Action")
case "Cancella"
Conn.Execute Request.querystring("Query")
Response.Redirect "GestioneDatabase.asp?Tabella=" & TabellaDaVisualizzare & "&TOP=" & clng(Request.QueryString ("TOP"))
case "Aggiorna"
rs.Open "SELECT * FROM " & TabellaDaVisualizzare & " " & Request.querystring("Query"),conn,1,3
set mNew = mtable.tables(TabellaDaVisualizzare)
%>
<table width="98%" border="1">
<tr>
<td colspan=<%response.write mnew.columns.count+1%>>
<div align="center">
<font face="Verdana, Arial, Helvetica, sans-serif" size="+1" color="#FFFFFF">
<b>
<%
response.write "Gestione Tabella " & mNew.name
%>
</b>
</font>
</div>
</td>
</tr>
<tr>
<td>
</td>
<%
i=0
while i < mNew.columns.count
if not mNew.columns(i).Properties(0) then
%>

<td>
<div align="center">
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1" color="#FFFFFF">
<%
response.write mNew.columns(i).name
%>
</font></p>
</div>
</td>
<%
end if
i=i+1
wend
%>

<tr>
<form method="POST" action=<%response.write "GestioneDatabase.asp?Tabella="& TabellaDaVisualizzare & "&Action=SalvaModifiche&Query=" & server.URLEncode(Request.querystring("Query")) & "&TOP=" & clng(Request.QueryString ("TOP"))%> id=form1 name=form1>
<td>
<input type="submit" value="Salva" name="B1">
</td>
<%
i=0
while i < mNew.columns.count
if not mNew.columns(i).Properties(0) then
%>

<td>
<input type="Text" name="<%= mNew.columns(i).name%>" value="<%= rs(mNew.columns(i).name) %>" style="WIDTH: 100%; HEIGHT: 100%; BACKGROUND-COLOR: silver">
</td>
<%
end if
i=i+1
wend
%>
</form>
</tr>
</table>
<%
case "Aggiungi"
set mNew = mtable.tables(TabellaDaVisualizzare)
%>
<table width="98%" border="1">
<tr>
<td colspan=<%response.write mnew.columns.count+1%>>
<div align="center">
<font face="Verdana, Arial, Helvetica, sans-serif" size="+1" color="#FFFFFF">
<b>
<%
response.write "Gestione Tabella " & mNew.name
%>
</b>
</font>
</div>
</td>
</tr>
<tr>
<td>
</td>
<%
i=0
while i < mNew.columns.count
if not mNew.columns(i).Properties(0) then
%>

<td>
<div align="center">
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-1" color="#FFFFFF">
<%
response.write mNew.columns(i).name
%>
</font></p>
</div>
</td>
<%
end if
i=i+1
wend
%>

<tr>
<form method="POST" action=<%response.write "GestioneDatabase.asp?Tabella="& TabellaDaVisualizzare & "&Action=Salva" & "&TOP=" & clng(Request.QueryString ("TOP"))%> id=form4 name=form4>
<td>
<input type="submit" value="Salva" name="B1">
</td>
<%
i=0
while i < mNew.columns.count
if not mNew.columns(i).Properties(0) then
%>

<td>
<input type="Text" name="<%= mNew.columns(i).name%>" style="WIDTH: 100%; HEIGHT: 100%; BACKGROUND-COLOR: silver">
</td>
<%
end if
i=i+1
wend
%>
</form>
</tr>
</table>
<%
case "Salva"
set mNew = mtable.tables(TabellaDaVisualizzare)
i=0
sInsert = ""
while i < mNew.columns.count
if sInsert = "" then
sInsert = ") VALUES ("
sCampo = "INSERT INTO " & TabellaDaVisualizzare & "("
select case mNew.columns(i).type
case 11,3
if not mNew.columns(i).Properties(0) then
sCampo = sCampo & mNew.columns(i).name
sInsert = sInsert & request.form(mNew.columns(i).name)
end if
case 202,203
sCampo = sCampo & mNew.columns(i).name
apex request.form(mNew.columns(i).name),sString
sInsert = sInsert & "'" & sString & "'"
case 7
sCampo = sCampo & mNew.columns(i).name
sInsert = sInsert & "#" & request.form(mNew.columns(i).name) & "#"
end select
else
select case mNew.columns(i).type
case 11,3
if not mNew.columns(i).Properties(0) then
sCampo = sCampo & "," & mNew.columns(i).name
sInsert = sInsert & "," & request.form(mNew.columns(i).name)
end if
case 202,203
sCampo = sCampo & "," & mNew.columns(i).name
apex request.form(mNew.columns(i).name),sString
sInsert = sInsert & ",'" & sString & "'"
case 7
sCampo = sCampo & mNew.columns(i).name
sInsert = sInsert & "#" & request.form(mNew.columns(i).name) & "#"
end select
end if
i=i+1
wend
Conn.Execute sCampo & sInsert & ")"
Response.Redirect "GestioneDatabase.asp?Tabella=" & TabellaDaVisualizzare & "&TOP=" & clng(Request.QueryString ("TOP"))
case "SalvaModifiche"
set mNew = mtable.tables(TabellaDaVisualizzare)
i = 0
sUpdate = ""
while i < mNew.columns.count
select case mnew.columns(i).type
case 11,3
if not mNew.columns(i).Properties(0) then
if sUpdate = "" then
sUpdate ="UPDATE " & TabellaDaVisualizzare & " SET " & mnew.columns(i).name & "=" & request.form(mnew.columns(i).name)
else
sUpdate=sUpdate & "," & mnew.columns(i).name & "=" & request.form(mnew.columns(i).name)
end if
end if
case 202,203
if sUpdate = "" then
apex request.form(mnew.columns(i).name),sString
sUpdate="UPDATE " & TabellaDaVisualizzare & " SET " & mnew.columns(i).name & " = '" & sString & "'"
else
apex request.form(mnew.columns(i).name),sString
sUpdate=sUpdate & "," & mnew.columns(i).name & "='" & sString & "'"
end if
case 7
if sUpdate = "" then
sUpdate ="UPDATE " & TabellaDaVisualizzare & " SET " & mnew.columns(i).name & "=#" & request.form(mnew.columns(i).name) & "#"
else
sUpdate=sUpdate & "," & mnew.columns(i).name & "=#" & request.form(mnew.columns(i).name) & "#"
end if
end select
i=i+1
wend
if sUpdate <> "" then
Conn.Execute sUpdate & " " & Request.querystring("Query")
Response.Redirect "GestioneDatabase.asp?Tabella=" & TabellaDaVisualizzare & "&TOP=" & clng(Request.QueryString ("TOP"))
end if
end select
end if
end if
set Rs = nothing
set Conn = nothing
%>
</body>
</html>

28 messaggi dal 19 giugno 2001
prova così...


metti nella prima riga questo codice


<%response.buffer=true%>

dovrebbe funzionare

METAL NEVER DIE
386 messaggi dal 25 maggio 2001
Ho fatto la modifica,ho inserito quella riga però mi da sempre errore.Perchè?

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.