Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

criacaoi7

Formulário não envia dados para o DB

Recommended Posts

Oi pessoal, beleza.

 

 

 

Tenho a página abaixo que envia os dados do formulário para o DB. O problema que tem ocorrido é que emebora não escreve nenhum erro na tela, os dados não são enviados para o banco. Qual pode ser o problema da minha página.

 

Já chequei o DB e não tem nada lá.

 

 

 

Vejam o código...

 

 

<% Server.ScriptTimeout = 500000
Dim  Form: Set Form = New ASPForm 
%>
<!--#INCLUDE FILE="_upload.asp"-->
<%
Server.ScriptTimeout = 10000
Form.SizeLimit = 10240*1024'10MB
if len(Request.QueryString("UploadID"))>0 then
Form.UploadID = Request.QueryString("UploadID")'{/b}
end if
Const fsCompletted  = 0
If Form.State = fsCompletted Then 'Completted
Const VirtualFolder = ("fotos")
Dim DestinationPath, virtDestinationPath
DestinationPath = Server.mapPath(VirtualFolder) & "\"
virtDestinationPath = "http://" + Request.ServerVariables("SERVER_NAME") _
+ GetPath(Request.ServerVariables("SCRIPT_NAME") ) _
+ "/" + VirtualFolder + "/"
Dim RS: Set RS = OpenUploadRS
Dim FileField
For Each FileField in Form.Files.Items
if len(FileField.FileName)> 0 then 'File is specified.
Dim DestinationFileName
DestinationFileName = DestinationPath & FileField.FileName
FileField.SaveAs DestinationFileName
'Este comentário fiz questão de colocar, aqui é onde você acrecenta o nome dos campos que estão na sua tabela
RS.AddNew
RS("data") = Form.Texts.Item("data")&time()
RS("dia") = Form.Texts.Item("data")
RS("Evento") = Form.Texts.Item("evento")
RS("foto") = FileField.FileName
RS("Cidade") = Form.Texts.Item("cidade")
RS("local") = Form.Texts.Item("local")
RS("Fotografo") = Form.Texts.Item("fotografo")
'...
RS.Update
end if
Next 
response.write "<meta http-equiv='refresh' content='0; url=listargalerias.asp'/>"
Dim Field: For Each Field in Form.Files.Items
Next
ElseIf Form.State > 10 then
Const fsSizeLimit = &HD
Select case Form.State
case fsSizeLimit: response.write  "<br><Font Color=red>O seu limite de upload é de 10mb (" & Form.TotalBytes & "B) e voc~e exedeu esse limite. (" & Form.SizeLimit & "B)</Font><br>"
case else response.write "<br><Font Color=red>Some form error.</Font><br>"
end Select
End If'Form.State = 0 then
Function OpenUploadRS()
Dim RS  : Set RS = CreateObject("ADODB.Recordset")
RS.Open "Galeria", GetConnection, 2, 2
Set OpenUploadRS = RS
end Function 
Function GetConnection()
dim Conn: Set Conn = CreateObject("ADODB.Connection")
set Conn = createobject("adodb.connection")
Conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\web\olimpiadaconsespcombr\database\galeriafotos.mdb"
set GetConnection = Conn
end function
Function SplitFileName(FullPath)
Dim Pos, PosF
PosF = 0
For Pos = Len(FullPath) To 1 Step -1
Select Case Mid(FullPath, Pos, 1)
Case ":", "/", "\": PosF = Pos + 1: Pos = 0
End Select
Next
If PosF = 0 Then PosF = 1
SplitFileName = PosF
End Function
Function GetPath(FullPath)
GetPath = left(FullPath, SplitFileName(FullPath)-1)
End Function
Dim UploadID, PostURL
UploadID = Form.NewUploadID
PostURL = Request.ServerVariables("SCRIPT_NAME") & "?UploadID=" & UploadID'{/b}
%> 



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<script language="Javascript"> 



// Início da Marcara do Data
function FormataData(evt) {
vr = (navigator.appName == 'Netscape') ?evt.target.value : evt.srcElement.value;
if(vr.length == 2) vr = vr+"/";
  if(vr.length == 5) vr = vr+"/";
	return vr;
}



</script>



<script>
function number(){
if(event.keyCode<48 || event.keyCode>57) 
event.returnValue=false;
} 



</script>
 <TITLE>Cido Silva - Sites, softwares e aplicações para web</TITLE>
 <STYLE TYPE="text/css"><!--TD {font-family:Arial,Helvetica,sans-serif }TH {font-family:Arial,Helvetica,sans-serif }TABLE {font-size:10pt;font-family:Arial,Helvetica,sans-serif }--></STYLE>
 <meta name="robots" content="noindex,nofollow">
<meta name="generator" content="Namo WebEditor v5.0">
</HEAD>
<BODY BGColor="#ECE9D8" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">




<table align="center" cellpadding="0" cellspacing="0" width="779">
	<tr>
		<td width="1121"><Div style=width:600>
<TABLE cellSpacing="0" cellPadding="0" width="779" bgColor=white align="center">
  
  <TR>
	<TD bgcolor="#2D83C0">
				<p align="center"> <font face="Arial" color="white"><span style="font-size:14pt;"><b>Adicionar 
			Galerias</b></span></font></p>
  </TD></TR>  <TR>
	<TD bgcolor="white">
<Div style=width:600>
<TABLE cellSpacing="0" cellPadding="0" bgcolor="white" width="774" align="center">
<form method=post ENCTYPE="multipart/form-data" onSubmit="return ValidaFormulario();">
<TR>
 <TD width="195">
									<p align="center"> </TD>
 <TD Align=Right width="579">
									<p align="center"><input type="submit" Name="Action" value="Clic aqui para criar a galeria"></TD>
</TR>
<TR>
 <TD width="774" colspan="2"><form name="formulario" method="POST" action="AdicionarGaleria1.asp" onSubmit="return ValidaFormulario();" >
 <table width="100%" align="center" cellpadding="0" cellspacing="0">
  <tr>
   <td width="147" align="right" bgcolor="white">
									<p align="right"><span style="font-size:10pt;"><b>Foto da capa</b></span></td>
   <td width="13" align="right" bgcolor="white">
																<p> </p>
</td>
   <td width="614" bordercolor="#800000" bgcolor="white">
									<p align="left"><input type="file" name="SourceFile" style="border-style: solid; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px; font-family:Tahoma; font-size:8pt" size="45"></td>
  </tr>
  <tr>
   <td width="147" align="right" bgcolor="white">
   <p align="right"><font face="Arial" style="font-size: 8pt"><span style="font-size:10pt;"><b>Nome Festa:</b></span></font></td>
   <td width="13" align="right" bgcolor="white">
																<p> </p>
</td>
   <td width="614" bordercolor="#800000" bgcolor="white">
   <p align="left"><input type="text" name="evento" size="61" style="border-style: solid; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px; font-family:Tahoma; font-size:8pt"></td>
  </tr>
  <tr>
   <td width="147" align="right" bgcolor="white">
   
   <p align="right"><font face="Arial" style="font-size: 8pt"><span style="font-size:10pt;"><b>Fotografo:</b></span></font></td>
   <td width="13" align="right" bgcolor="white">
   
																<p> </p>
</td>
   <td width="614" bordercolor="#800000" bgcolor="white">
   <p align="left"><input type="text" name="fotografo" size="61" style="border-style: solid; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px; font-family:Tahoma; font-size:8pt"></td>
  </tr>
  <tr>
   <td width="147" align="right" bgcolor="white">
   <p align="right"><font face="Arial" style="font-size: 8pt"><span style="font-size:10pt;"><b>Data Festa:</b></span></font></td>
   <td width="13" align="right" bgcolor="white">
																<p> </p>
</td>
   <td width="614" bordercolor="#800000" bgcolor="white">
   <p align="left"><input type="text" name="data" maxlength="10" onkeypress="number(this)" onkeyup="this.value = FormataData(event)" size="20" style="border-style: solid; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px; font-family:Tahoma; font-size:8pt"></td>
  </tr>
  <tr>
   <td width="147" align="right" bgcolor="white">
   <p align="right"><font face="Arial" style="font-size: 8pt"><span style="font-size:10pt;"><b>Local:</b></span></font></td>
   <td width="13" align="right" bgcolor="white">
																<p> </p>
</td>
   <td width="614" bordercolor="#800000" bgcolor="white">
   <p align="left"><input type="text" name="local" size="61" style="border-style: solid; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px; font-family:Tahoma; font-size:8pt"></td>
  </tr>
  <tr>
   <td width="147" align="right" bgcolor="white">
   <p align="right"><font face="Arial" style="font-size: 8pt"><span style="font-size:10pt;"><b>Cidade:</b></span></font></td>
   <td width="13" align="right" bgcolor="white">
																<p> </p>
</td>
   <td width="614" bordercolor="#800000" bgcolor="white">
   <p align="left"><input type="text" name="cidade" size="61" style="border-style: solid; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px; font-family:Tahoma; font-size:8pt"></td>
  </tr>
 </table>



</form>		</TD>
</TR>



</form></Table>



 




</Div>
  </TD></TR></TABLE>



 




</Div>
		</td>
	</tr>
</table>
<Div style=width:600>
	<p align="center"> </p>
	<p align="center"> </p>
<CENTER>
 </CENTER>
</Div>
</BODY></HTML>

Compartilhar este post


Link para o post
Compartilhar em outros sites

cade a funçao ValidaFormulario?

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.