Ir para conteúdo

POWERED BY:

Arquivado

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

BOMBA

Cadastro usando SQL Server + ASP

Recommended Posts

Olá amigos , boa noite.

Bom estou com uma mega dúvida, trabalho com suporte na empresa , porém o pessoal acha que quem faz informática é obrigado a saber TUDO na área, bom eu entendo um pouquinho de ASP com ACCESS , só que lá na empresa me deram uma parada pra eu fazer em 1 semana, é uma página da intranet deles porém com ASP + SQL SERVER , e pra piorar me deram um código pronto de uma cara que era programador em ASP , o que está acontecendo, estou boiando no código.

Bom oq eles querem é dar uma enxugada no sistema , querem tirar campos que não servem pra nada , estou fazendo isso porém está dando erro , quando clico em gravar não esta enviando nada , apenas fica encrito "ERRO NA PÁGINA" , e pra piorar mais ainda no código não sei em que tabela os dados estão sendo gravados , pois no access é mole , é só ver o código "strSQL = "INSERT INTO cadastro (nome , idade)"

strSQL = strSQL + " VALUES ('"& nome &"','"& idade &"')" e já no SQL não consigo enxergar em qual tabela os dados estão indo, sei qual o banco pois existe uma INCLUDE( conexao ) no código.

 

Alguem pode me ajudar, please ?? Estou querendo entender oq o código está kerendo dizer e se possível alguem da uma enxugada pra mim sem que de erro ao jogar os dados na tabela:

 

Este é o Código:

 

CODE
<html>

<!--#include file="../../include/menu.asp"-->

<!--#include file="../../include/conexao.asp"-->

<head>

<script Language="JavaScript">

function loadPage(pageURL){

location.href = pageURL.options[pageURL.selectedIndex].value

}

</SCRIPT>

<LINK rel="stylesheet" type="text/css" href="../../controle.css">

<%

 

if request("cav") = "" then

strcav = ""

else

strcav = "checked"

end if

 

 

%>

<script>

function f_questions()

{

if (this.document.FrmInc.data.value == "")

{alert("Informe a data !")

document.FrmInc.data.focus();

return false;}

if (this.document.FrmInc.unidade.value == "")

{alert("Informe a unidade !")

document.FrmInc.unidade.focus();

return false;}

if (this.document.FrmInc.equipe.value == "")

{alert("Informe a equipe !")

document.FrmInc.equipe.focus();

return false;}

if (this.document.FrmInc.fornecedor.value == "")

{alert("Informe o fornecedor !")

document.FrmInc.fornecedor.focus();

return false;}

 

if (this.document.FrmInc.equipamento.value == "")

{alert("Informe o equipamento !")

document.FrmInc.equipamento.focus();

return false;}

 

if (this.document.FrmInc.modelo.value == "")

{alert("Informe o modelo !")

document.FrmInc.modelo.focus();

return false;}

 

if (this.document.FrmInc.localizacao.value == "")

{alert("Informe a localização !")

document.FrmInc.localizacao.focus();

return false;}

if (this.document.FrmInc.equipamentoep.value == "")

{alert("Informe o nome do Equipamento !")

document.FrmInc.equipamentoep.focus();

return false;}

 

 

document.FrmInc.strimpri.value = '';

document.FrmInc.action = 'IncluirestacaoFinanceira.asp?Op=I&Tipo=';

FrmInc.submit();

 

}

 

</script>

 

<script>

function f_impri()

{

document.FrmInc.strimpri.value = 'imprimir';

FrmInc.submit();

 

}

</script>

 

<script>

function f_Muda()

{

document.FrmInc.nomeequipe.value = document.FrmInc.equipe.value;

document.FrmInc.nomefornecedor.value = document.FrmInc.fornecedor.value;

document.FrmInc.nomeequipamento.value = document.FrmInc.equipamento.value;

// document.FrmInc.nomemodelo.value = document.FrmInc.modelo.value;

document.FrmInc.nomeunidade.value = document.FrmInc.unidade.value;

document.FrmInc.marca.value = document.FrmInc.fornecedor.value;

document.FrmInc.marcaep.value = document.FrmInc.fornecedor.value;

document.FrmInc.action = 'estacaoFinanceira.asp';

FrmInc.submit();

}

</script>

 

<title>Cadastro Alocação de Estação Financeira</title>

<LINK rel="stylesheet" type="text/css" href="../../siate.css">

<script LANGUAGE="JavaScript" src="../../include/Confirmacao.js"></script>

<body>

<%

on error resume next

strmodelo = split(request("modelo"),"|")

modelo = strmodelo(0)

codequipamento = strmodelo(1)

'Response.Write Request("nomeequipamento")

'Response.End

%>

<form name="FrmInc">

<input type=hidden name=projeto value="2">

<input type=hidden name=strval value="<%=request("strval")%>">

<input type=hidden name=codequipamento value="<%=request("codequipamento")%>">

<input type=hidden name=strimpri value='<%=request("strimpri")%>'>

<input type=hidden name=strunidade value='<%=request("strunidade")%>'>

<input type=hidden name=nomefornecedor value='<%=request("fornecedor")%>'>

<input type=hidden name=nomeequipamento value='<%=request("nomeequipamento")%>'>

<input type=hidden name=nomeunidade value='<%=request("nomeunidade")%>'>

<input type=hidden name="nomeequipe" id="nomeequipe" value='<%=request("equipe")%>'>

<input type=hidden name="alocado" id="alocado" value='<%=request("alocado")%>'>

 

<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0">

<tr class=titulo align="center">

<td width="50%">

<b>Alocação de Estação Financeira</b>

</td>

</tr>

</table><br>

<table width="90%" border="0" align="center" bordercolor="lightgrey">

<tr align="center">

<td width="18%" align="left" class=font>

<b>Unidade </b>

</td>

<td align=left class=font>

<select id=unidade name=unidade onchange=java script:f_Muda();>

<option>= Selecione a Unidade =</option>

<%

Set RS = Server.CreateObject("ADODB.Recordset")

SQL = "SELECT * FROM TB_UNIDADES"

RS.Open sql, cn

Do While Not RS.Eof

if request("nomeunidade") = RS.Fields("unidade") then%>

<option selected value='<%=RS.Fields("unidade")%>'><%=RS.Fields("Codunidade")& " - " & RS.fields("unidade")%></option>

<%else%>

<option value='<%=RS.Fields("unidade")%>'><%=RS.Fields("Codunidade")& " - " & RS.fields("unidade")%></option>

<%end if

RS.movenext

loop

RS.close

%>

</select>

</td>

<TD class=font><b>Data </b>

<INPUT NAME="data" VALUE="<%=request("data")%>" size="7">

</TD>

</tr>

<tr align="center">

<td align="left" class=font>

<b>Equipe Técnica</b>

</td>

<td colspan=3 align=left>

<INPUT NAME="equipe" value="<%=request("equipe")%>">

<input type=checkbox value=1 name=Cav <%=strcav%>> <b>CAV</b>

</td>

</tr>

</table>

<br>

<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="gray">

<tr align="center">

<td width="55%" align="left" colspan=6 class=font>

<b> 1. Identificação do Equipamento:</b>

</td>

</tr>

<%If request("strimpri") = "" then 'COMEÇO DA IMPRESSAO%>

<tr align="center" BGCOLOR=#EEEEEE>

<td width="13%" align="left" class=font>

Fornecedor

</td>

<td width="13%" align="left" class=font>

Equipamento

</td>

<td width="13%" align="left" class=font>

Modelo

</td>

 

</tr>

<tr align="center" BGCOLOR=#EEEEEE>

<td align="center" class=font>

<SELECT id=fornecedor name=fornecedor onchange=java script:f_Muda();>

<OPTION value="" selected>=Fornecedor=</OPTION>

<%

Set RSdi = Server.CreateObject("ADODB.Recordset")

SQL = "SELECT Codfornecedor,fornecedor FROM TB_FORNECEDORES ORDER BY FORNECEDOR"

RSdi.Open sql, cn

Do While Not RSDi.Eof

if request("nomefornecedor") = RSDi.Fields("fornecedor") then%>

<option selected value='<%=RSDi.Fields("fornecedor")%>'><%=RSDi.fields("fornecedor")%></option>

<%else%>

<option value='<%=RSDi.Fields("fornecedor")%>'><%=RSDi.fields("fornecedor")%></option>

<%end if

RSDi.movenext

loop

RSDi.close%>

</select>

</td>

<td align="center" >

<SELECT id=equipamento name=equipamento onchange=java script:f_Muda();>

<OPTION value="" selected>=Equipamento=</OPTION>

<%

Set RSdi = Server.CreateObject("ADODB.Recordset")

sql = "SELECT TB_EQUIPAMENTO.Descricao, TB_FORNECEDORES.Fornecedor "

sql = sql & "FROM TB_EQUIPAMENTO INNER JOIN TB_FORNECEDORES ON "

sql = sql & "TB_EQUIPAMENTO.CodFornecedor = TB_FORNECEDORES.CodFornecedor "

sql = sql & "GROUP BY TB_EQUIPAMENTO.Descricao, TB_FORNECEDORES.Fornecedor "

sql = sql & "HAVING (TB_FORNECEDORES.Fornecedor = '"& request("nomefornecedor")&"')"

RSdi.Open sql, cn

Do While Not RSDi.Eof

if request("nomeequipamento") = RSDi.Fields("Descricao") then %>

<option selected value='<%=RSDi.Fields("Descricao")%>'><%=RSDi.fields("Descricao")%></option>

 

<%else%>

<option value='<%=RSDi.Fields("Descricao")%>'><%=RSDi.fields("Descricao")%></option>

<%end if

 

RSDi.movenext

loop

RSDi.close%>

</select>

</td>

<td align="left">

<SELECT id=modelo name=modelo onchange=java script:f_Muda();>

<OPTION value="" selected>=Modelo=</OPTION>

<%

Set RSdi = Server.CreateObject("ADODB.Recordset")

sql2 ="SELECT distinct TB_FORNECEDORES.Fornecedor,TB_EQUIPAMENTO.Modelo,TB_EQUIPAMENTO.CodEquipamento FROM TB_EQUIPAMENTO INNER JOIN "

sql2 = sql2 & "TB_FORNECEDORES ON TB_EQUIPAMENTO.CodFornecedor = TB_FORNECEDORES.CodFornecedor "

sql2 = sql2 & "WHERE (TB_Equipamento.descricao ='"& request("equipamento")&"') GROUP BY TB_FORNECEDORES.Fornecedor,TB_EQUIPAMENTO.CodEquipamento, "

sql2 = sql2 & "TB_EQUIPAMENTO.Modelo HAVING (TB_FORNECEDORES.Fornecedor ='"& request("nomefornecedor")&"')"

RSdi.Open sql2, cn

Do While Not RSDi.Eof

if modelo = RSdi("modelo") then%>

<option selected value='<%=RSdi("Modelo")&"|"&RSdi("codequipamento")%>'><%=RSdi("Modelo")%></option>

<%else%>

<option value='<%=RSdi("Modelo")&"|"&RSdi("codequipamento")%>'><%=RSdi("Modelo")%></option>

<%end if

 

RSDi.movenext

loop

RSDi.close

%>

</select>

</td>

</tr>

</table>

<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="gray">

<tr BGCOLOR=#EEEEEE>

<td width="10%" align="left" class=font>

Lacre

</td>

<td width="10%" align="left" class=font>

Patrimonio

</td>

<td width="10%" align="left" class=font>

Num Série

</td>

<td width="10%" align="left" class=font>

End. Lógico

</td>

<td width="10%" align="left" class=font>

Localização

</td>

</tr>

<tr BGCOLOR=#EEEEEE>

<td align="left" class=font>

<input type=hidden name="marca" size=19 value="<%=request("marca")%>" maxlength="19">

<input name="lacre" size=19 value="<%=request("lacre")%>" maxlength="19">

</td>

<td align="left" class=font>

<input name="patrimonio" size=19 value="<%=request("patrimonio")%>" maxlength="19">

</td>

<td align="left" class=font>

<input name="serie" size=19 value="<%=request("serie")%>">

</td>

<td align="left" class=font>

<input name="endlogico" size=19 value="<%=request("endlogico")%>">

</td>

<td align="left" class=font >

<select id="localizacao" name="localizacao">

<option VALUE="">= Localização =</option>

<%

Set RS = Server.CreateObject("ADODB.Recordset")

SQL = "SELECT * FROM TB_LOCALIZACAO"

RS.Open sql, cn,3,1,1

Do While Not RS.Eof

If RS.Fields("CODIGO") = Cint(Request("localizacao")) Then%>

<option selected value="<%=RS.Fields("CODIGO")%>"><%=RS.Fields("DESCRICAO")%></option>

<%Else%>

<option value="<%=RS.Fields("CODIGO")%>"><%=RS.Fields("DESCRICAO")%></option>

<%End If

 

RS.movenext

loop

RS.close

%>

</select>

</td>

</tr>

</table>

<BR>

<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="gray">

<tr>

<td width="10%" align="left" class=font colspan=5>

<b>Periféricos do equipamento: </b> <font color="royalblue"><%=request("equipamento")%> </font><b>Modelo:</b> <font color="royalblue"><%= modelo%></font>

</td>

</tr>

 

<tr BGCOLOR=#EEEEEE>

<td width="10%" align="left" class=font>

Equipamento

</td>

<td width="10%" align="left" class=font>

Marca

</td>

<td width="10%" align="left" class=font>

Modelo

</td>

<td width="10%" align="left" class=font>

Num. Série

</td>

<td width="10%" align="left" class=font>

Patrimônio

</td>

</tr>

<tr BGCOLOR=#EEEEEE>

<td align="left" class=font>

<select name=equipamentoep>

<option value="">= Equipamento =</option>

<option value="Impressora">Impressora</option>

<option value="Leitora">Leitora</option>

<option value="PIN">PIN</option>

<option value="NAO POSSUI">NÃO POSSUI</option>

</select>

</td>

<td align="left" class=font>

<input name="marcaep" size=19 value="<%=request("marcaep")%>" maxlength="19">

</td>

<td align="left" class=font>

<input name="modeloep" size=19 value="<%=request("modeloep")%>">

</td>

<td align="left" class=font>

<input name="numserieep" size=19 value="<%=request("numserieep")%>">

</td>

<td align="left" class=font>

<input name="patrimonioep" size=19 value="<%=request("patrimonioep")%>">

</td>

</tr>

</table>

<%

IF REQUEST("strUNIDADE") <> "" THEN

Set rs4 = server.CreateObject("adodb.recordset")

SQL4 = "SELECT CODIGO FROM TB_ALOCADO WHERE CODUNIDADE = " & request("strUNIDADE") & " AND PROJETO = 2"

SQL4 = SQL4 & " AND NSERIE = '" & request("serie") & "'"

SQL4 = SQL4 & " AND endlogico = '" & request("endlogico") & "'"

SQL4 = SQL4 & " AND codfornecedor = '" & request("codfornecedor") & "'"

SQL4 = SQL4 & " AND modelo = '" & modelo & "'"

SQL4 = SQL4 & " AND patrimonio = '" & request("patrimonio") & "'"

rs4.Open sql4,cn,3,1,1

'Response.Write SQL4

CODIGOALOCADO = rs4("CODIGO")

If CODIGOALOCADO = "" Then

CODIGOALOCADO = "0"

else

CODIGOALOCADO = CODIGOALOCADO

end if

Set rs2 = server.CreateObject("adodb.recordset")

SQL2 = "SELECT * FROM TB_ESTACAOFINANCEIRA WHERE CODALOCADO = " & CODIGOALOCADO

'Response.Write SQL2

'Response.End

'SQL2 = SQL2 & " AND CODEQUIPAMENTO = " & request("codequipamento")

rs2.Open sql2,cn,3,1,1 %>

</table>

<br>

<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="gray">

<tr BGCOLOR=#EEEEEE>

<td width="10%" align="left" class=font>

End. Lógico

</td>

<td width="10%" align="left" class=font>

Marca

</td>

<td width="20%" align="left" class=font>

Modelo

</td>

<td width="15%" align="left" class=font>

N/S

</td>

<td width="15%" align="left" class=font>

Patrimônio

</td>

<td width="10%" align="left" class=font>

Excluir

</td>

</tr><%

Do While not rs2.EOF%>

<tr >

<td width="5%" align="left" class=font>

<%=rs2.Fields ("EQUIPAMENTO")%>

</td>

<td width="10%" align="left" class=font>

<%=rs2.Fields("marca")%>

</td>

<td width="20%" align="left" class=font>

<%=rs2.Fields("modelo")%>

</td>

<td width="15%" align="left" class=font>

<%=rs2.Fields ("numserie")%>

</td>

<td width="15%" align="left" class=font>

<%=rs2.Fields ("patrimonio")%>

</td>

<td width="10%" align="left" class=font>

<a href="Excluirestacaofinanceira.asp?Op=I&lacre=<%=request("lacre")%>&nomeequipamento=<%=request("nomeequipamento")%>&codfornecedor=<%=request("codfornecedor")%>&codigo=<%=rs2.fields("Codigoestacaofinanceira")%>&codequipamento=<%= strmodelo(1)%>&modelo=<%=modelo%>&projeto=2&nomeunidade=<%=request("nomeunidade")%>&equipe=<%=request("equipe")%>&strunidade=<%=request("strunidade")%>&equipamento=<%=request("equipamento")%>&nomefornecedor=<%=request("nomefornecedor")%>&data=<%=request("data")%>&patrimonio=<%=request("patrimonio")%>&serie=<%=request("serie")%>&endlogico=<%=request("endlogico")%>&localizacao=<%=request("localizacao")%>&marca=<%=request("marca")%>"

value="<%=rs2.Fields("Modelo")%>"

onclick="Confirmacao('do serviço ',this,'estacaofinanceira.asp?Op=I&lacre=<%=request("lacre")%>&nomeequipamento=<%=request("nomeequipamento")%>&codfornecedor=<%=request("codfornecedor")%>&codigo=<%=rs2.fields("Codigoestacaofinanceira")%>&projeto=2&nomeunidade=<%=request("nomeunidade")%>&equipe=<%=request("equipe")%>&strunidade=<%=request("strunidade")%>&equipamento=<%=request("Equipamento")%>&codequipamento=<%=codequipamento%>&modelo=<%= strmodelo(0)%>&nomefornecedor=<%=request("nomefornecedor")%>&data=<%=request("data")%>&patrimonio=<%=request("patrimonio")%>&serie=<%=request("serie")%>&endlogico=<%=request("endlogico")%>&localizacao=<%=request("localizacao")%>&marca=<%=request("marca")%>');">

<img width=15 height=15 border=0 src="../../Images/cancel_rd.gif" name="excluir" onclick="f_excluir()" title="Excluir" style="cursor : hand ;">

</td>

</tr>

<%rs2.MoveNext

loop

End if%>

</table><BR>

<%else

IF REQUEST("strUNIDADE") <> "" THEN

Set rs2 = server.CreateObject("adodb.recordset")

SQL2 = "SELECT * FROM TB_ALOCADO WHERE CODUNIDADE = " & request("strUNIDADE")&" AND PROJETO = 2"

cn.execute sql2

rs2.Open sql2,cn,3,1,1 %>

</table>

<BR><BR>

<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="gray">

<tr BGCOLOR=#EEEEEE>

<td width="5%" align="left" class=font>

<B>Tipo</B>

</td>

<td width="10%" align="left" class=font>

<B>End. Lógico</B>

</td>

<td width="10%" align="left" class=font>

<B>Marca</B>

</td>

<td width="20%" align="left" class=font>

<B>Modelo</B>

</td>

<td width="15%" align="left" class=font>

<B>N/S</B>

</td>

<td width="15%" align="left" class=font>

<B>Patrimônio</B>

</td>

</tr><%

Do While not rs2.EOF%>

<tr >

<td width="5%" align="left" class=font>

<%=rs2.Fields ("Tipo")%>

</td>

<td width="10%" align="left" class=font>

<%=rs2.Fields ("endlogico")%>

</td>

<td width="10%" align="left" class=font>

<%=rs2.Fields ("marca")%>

</td>

<td width="20%" align="left" class=font>

<%=rs2.Fields ("modelo")%>

</td>

<td width="15%" align="left" class=font>

<%=rs2.Fields ("nserie")%>

</td>

<td width="15%" align="left" class=font>

<%=rs2.Fields ("patrimonio")%>

</td>

</tr>

<%rs2.MoveNext

loop

End if%>

</TABLE>

<script>

{

window.print();

}

</SCRIPT>

<%end if' FIM DA IMPRESSAO%>

<BR><BR>

<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="gray">

<tr align="left">

<td align="left" colspan=2 cellspacing="2" class=font>

<b>2. Comentários adicionais:</B>

<td align="left">

</tr>

<tr align="left">

<td colspan=3>

<TEXTAREA id=TEXTAREA1 name=obs rows=6 cols=110><%=request("obs")%></TEXTAREA>

</td>

</td>

</tr>

<tr align="center" class=controle>

<td colspan=3>

<input type=button id="button" name="button" value=Gravar onclick="java script:f_questions();">

</td>

</td>

</tr>

</table><br>

 

</form>

</body>

</html>

BOM com este código me gera este formulário :

Imagem Postada

 

e eu queria tirar este campos sem que de erro:

 

Imagem Postada

 

 

Muito Obrigado e uma boa noite para todos.

 

Abraços

Compartilhar este post


Link para o post
Compartilhar em outros sites

1ª coisa para ajudar a encontrar o real erro, coloque a linha que contém o ON ERROR RESUME NEXT como comentário. Depois que isso for feito o real erro será apresentado.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bom dia.

Olá amigo , tudo bem?

Bom na verdade este código que eu postei , não gera erro pois é o código que o programador que era daqui fez, o código que eu to tentando fazer em cima desse é que gera erro.

<html>
 <!--#include file="../../include/menu.asp"-->
 <!--#include file="../../include/conexao.asp"-->
<head>
<script Language="JavaScript">
  function loadPage(pageURL){
	location.href = pageURL.options[pageURL.selectedIndex].value
	}
</SCRIPT>
<LINK rel="stylesheet" type="text/css" href="../../controle.css">

<script>
function f_questions()
{
if (this.document.FrmInc.data.value == "")
	{alert("Informe a data !")
	document.FrmInc.data.focus();
	return false;}
if (this.document.FrmInc.unidade.value == "")
	{alert("Informe a unidade !")
	document.FrmInc.unidade.focus();
	return false;}
if (this.document.FrmInc.equipe.value == "")
	{alert("Informe a equipe !")
	document.FrmInc.equipe.focus();
	return false;}
if (this.document.FrmInc.fornecedor.value == "")
	{alert("Informe o fornecedor !")
	document.FrmInc.fornecedor.focus();
	return false;}

if (this.document.FrmInc.equipamento.value == "")
	{alert("Informe o equipamento !")
	document.FrmInc.equipamento.focus();
	return false;}

if (this.document.FrmInc.modelo.value == "")
	{alert("Informe o modelo !")
	document.FrmInc.modelo.focus();
	return false;}

if (this.document.FrmInc.localizacao.value == "")
	{alert("Informe a localização !")
	document.FrmInc.localizacao.focus();
	return false;}
if (this.document.FrmInc.equipamentoep.value == "")
	{alert("Informe o nome do Equipamento !")
	document.FrmInc.equipamentoep.focus();
	return false;}


document.FrmInc.strimpri.value = '';
document.FrmInc.action = 'IncluirestacaoFinanceira.asp?Op=I&Tipo=';
FrmInc.submit();

}

</script>

<script>
function f_impri()
{
document.FrmInc.strimpri.value = 'imprimir';
FrmInc.submit();

}
</script>

<script>
function f_Muda()
{
	//document.FrmInc.nomeequipe.value = document.FrmInc.equipe.value;
	document.FrmInc.nomefornecedor.value = document.FrmInc.fornecedor.value;
	document.FrmInc.nomeequipamento.value = document.FrmInc.equipamento.value;
	//document.FrmInc.nomemodelo.value = document.FrmInc.modelo.value;
	document.FrmInc.nomeunidade.value = document.FrmInc.unidade.value;
	document.FrmInc.marca.value = document.FrmInc.fornecedor.value;
	document.FrmInc.marcaep.value = document.FrmInc.fornecedor.value;
	document.FrmInc.action = 'estacaoFinanceira.asp';
   FrmInc.submit();
}
</script>

<title>Cadastro de Estações</title>
<LINK rel="stylesheet" type="text/css" href="../../siate.css">
<script LANGUAGE="JavaScript" src="../../include/Confirmacao.js"></script>
<body>
<%
on error resume next
'strmodelo = split(request("modelo"),"|")
modelo = strmodelo(0)
codequipamento = strmodelo(1)
'Response.Write Request("nomeequipamento")
'Response.End 
%>
<form name="FrmInc">
<input type=hidden name=projeto value="2">
<input type=hidden name=strval value="<%=request("strval")%>">
<input type=hidden name=codequipamento value="<%=request("codequipamento")%>">
<input type=hidden name=strimpri value='<%=request("strimpri")%>'>
<input type=hidden name=strunidade value='<%=request("strunidade")%>'>
<input type=hidden name=nomefornecedor value='<%=request("fornecedor")%>'>
<input type=hidden name=nomeequipamento value='<%=request("nomeequipamento")%>'>
<input type=hidden name=nomeunidade value='<%=request("nomeunidade")%>'>
<input type=hidden name="nomeequipe" id="nomeequipe" value='<%=request("equipe")%>'>
<input type=hidden name="alocado" id="alocado" value='<%=request("alocado")%>'>

<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0">
	<tr class=titulo align="center"> 
	  <td width="50%">		
		<b>Cadastro de Estações </b>
	  </td>
	</tr>	
  </table><br>
		<table width="90%" border="0" align="center" bordercolor="lightgrey">
			<tr align="center"> 
			  <td width="18%" align="left" class=font>		
				<b>Unidade  </b>
			  </td>
			  <td align=left class=font> 
				<select id=unidade name=unidade onchange=java script:f_Muda();> 
					<option>= Selecione a Unidade =</option>
					<%
						Set RS = Server.CreateObject("ADODB.Recordset")
						SQL = "SELECT * FROM TB_UNIDADES" 
						RS.Open sql, cn
							Do While Not RS.Eof
						  if request("nomeunidade") = RS.Fields("unidade") then%>
						   <option selected value='<%=RS.Fields("unidade")%>'><%=RS.Fields("Codunidade")& " - " & RS.fields("unidade")%></option>
						<%else%>					
						   <option value='<%=RS.Fields("unidade")%>'><%=RS.Fields("Codunidade")& " - " & RS.fields("unidade")%></option>
						<%end if
						RS.movenext
							loop
						RS.close
					%>
				</select>
			  </td>
			  <TD class=font><b>Data </b>
				<INPUT NAME="data" VALUE="<%=date()%>" size="7">
			  </TD>
			</tr>
			</table>
			<br>
		<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="gray" height="97">
			<tr align="center"> 
			  <td width="55%" align="left" colspan=6 class=font>		
			   <b> 1. Identificação do Equipamento:</b>
			  </td>
			</tr>
			<%If request("strimpri") = "" then 'COMEÇO DA IMPRESSAO%>
			<tr align="center" BGCOLOR=#EEEEEE> 
			  <td width="13%" align="left" class=font>		
				<u>Fornecedor</u>
			  </td>
			  <td width="13%" align="left" class=font>		
				                    		
				<u>Equipamento</u>
			  </td>
			  <td width="13%" align="left" class=font>		
				<u>Modelo</u>
			  </td>

			</tr>
			<tr align="center" BGCOLOR=#EEEEEE> 
			  <td align="center" class=font height="39">		
			  <SELECT id=fornecedor name=fornecedor onchange=java script:f_Muda();> 
			<OPTION value="" selected>=Fornecedor=</OPTION>
			<%
			Set RSdi = Server.CreateObject("ADODB.Recordset")
			SQL = "SELECT Codfornecedor,fornecedor FROM TB_FORNECEDORES ORDER BY FORNECEDOR" 
			RSdi.Open sql, cn
			Do While Not RSDi.Eof
			   if request("nomefornecedor") = RSDi.Fields("fornecedor") then%>
				<option selected value='<%=RSDi.Fields("fornecedor")%>'><%=RSDi.fields("fornecedor")%></option>
			 <%else%>					
				<option value='<%=RSDi.Fields("fornecedor")%>'><%=RSDi.fields("fornecedor")%></option>
			 <%end if 
				RSDi.movenext
			loop
				RSDi.close%>
			</select>
			</td>
			  <td align="center" height="39" >		
			  <SELECT id=equipamento name=equipamento onchange=java script:f_Muda();> 
			<OPTION value="" selected>=Equipamento=</OPTION>
			<%
						Set RSdi = Server.CreateObject("ADODB.Recordset")
						sql = "SELECT TB_EQUIPAMENTO.Descricao, TB_FORNECEDORES.Fornecedor "
						sql = sql & "FROM TB_EQUIPAMENTO INNER JOIN TB_FORNECEDORES ON "
						sql = sql & "TB_EQUIPAMENTO.CodFornecedor = TB_FORNECEDORES.CodFornecedor "
						sql = sql & "GROUP BY TB_EQUIPAMENTO.Descricao, TB_FORNECEDORES.Fornecedor "
						sql = sql & "HAVING (TB_FORNECEDORES.Fornecedor = '"& request("nomefornecedor")&"')"
						RSdi.Open sql, cn
					Do While Not RSDi.Eof
						if request("nomeequipamento") = RSDi.Fields("Descricao") then %>
							<option selected value='<%=RSDi.Fields("Descricao")%>'><%=RSDi.fields("Descricao")%></option>
						
						<%else%>					
							<option value='<%=RSDi.Fields("Descricao")%>'><%=RSDi.fields("Descricao")%></option>
						<%end if 
						
						RSDi.movenext
					loop
					RSDi.close%>
					</select>
					</td>
					<td align="left" height="39">
			  <SELECT id=modelo name=modelo onchange=java script:f_Muda();> 
			<OPTION value="" selected>=Modelo=</OPTION>
					<%
						Set RSdi = Server.CreateObject("ADODB.Recordset")
						sql2 ="SELECT distinct TB_FORNECEDORES.Fornecedor,TB_EQUIPAMENTO.Modelo,TB_EQUIPAMENTO.CodEquipamento FROM TB_EQUIPAMENTO INNER JOIN "
						sql2 = sql2 & "TB_FORNECEDORES ON TB_EQUIPAMENTO.CodFornecedor = TB_FORNECEDORES.CodFornecedor "
						sql2 = sql2 & "WHERE (TB_Equipamento.descricao ='"& request("equipamento")&"') GROUP BY TB_FORNECEDORES.Fornecedor,TB_EQUIPAMENTO.CodEquipamento, " 
						sql2 = sql2 & "TB_EQUIPAMENTO.Modelo HAVING (TB_FORNECEDORES.Fornecedor ='"& request("nomefornecedor")&"')"	
						RSdi.Open sql2, cn
					Do While Not RSDi.Eof
						if modelo = RSdi("modelo") then%>
							<option selected value='<%=RSdi("Modelo")&"|"&RSdi("codequipamento")%>'><%=RSdi("Modelo")%></option>
						<%else%>					
							<option value='<%=RSdi("Modelo")&"|"&RSdi("codequipamento")%>'><%=RSdi("Modelo")%></option>
						<%end if 
						
						RSDi.movenext
					loop
					RSDi.close
					%>
					</select>
					</td>
					</tr>
				</table>
		<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="gray">
					<tr BGCOLOR=#EEEEEE>
					  <td width="10%" align="left" class=font height="33">		
						<u>Patrimonio</u>
					  </td>
					  <td width="19%" align="left" class=font height="33">		
						
					  </td>
					  <td width="33%" align="left" class=font height="33">		
						<u>Num Série</u>
					  </td>
					  <td width="20%" align="left" class=font height="33">		
						<u>End. Lógico</u>
					  </td>
					  <td width="12%" align="left" class=font height="33"> 		
						</td>
					</tr>
			<tr BGCOLOR=#EEEEEE>
			  <td align="left" class=font>		
				<input type=hidden name="marca" size=19 value="<%=request("marca")%>" maxlength="19">
				<input name="patrimonio" size=19 value="<%=request("patrimonio")%>" maxlength="19">
			  </td>
			  <td align="left" class=font>		
				
			  </td>
			  <td align="left" class=font>		
				<input name="serie" size=19 value="<%=request("serie")%>">
			  </td>
			  <td align="left" class=font>		
				<input name="endlogico" size=19 value="<%=request("endlogico")%>">
			  </td>
			  <td align="left" class=font >		
				
			  </td>
			</tr>
			</table>
			<BR>
	 <table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="gray"> 
			<tr>
			  <td width="10%" align="left" class=font colspan=5>		
				
			  </td>
			 </tr>
			
			  <td align="left" class=font>		
			   
			  </td>
			  <td align="left" class=font> 		
				</td>
			  <td align="left" class=font> 		
				</td>
			  <td align="left" class=font> 		
				</td>
			</tr>	
</table>	
			<%
			IF REQUEST("strUNIDADE") <> "" THEN
			  Set rs4 = server.CreateObject("adodb.recordset")
				SQL4 = "SELECT CODIGO FROM TB_ALOCADO WHERE CODUNIDADE = " & request("strUNIDADE") & " AND PROJETO = 2"
				SQL4 = SQL4 & " AND NSERIE = '" & request("serie") & "'"
				SQL4 = SQL4 & " AND endlogico = '" & request("endlogico") & "'"
				SQL4 = SQL4 & " AND codfornecedor = '" & request("codfornecedor") & "'"
				SQL4 = SQL4 & " AND modelo = '" & modelo & "'"
				SQL4 = SQL4 & " AND patrimonio = '" & request("patrimonio") & "'"
				rs4.Open sql4,cn,3,1,1	
				'Response.Write SQL4
				CODIGOALOCADO = rs4("CODIGO")
				If CODIGOALOCADO = "" Then
					CODIGOALOCADO = "0"
				else 
					CODIGOALOCADO = CODIGOALOCADO
				end if					
			  Set rs2 = server.CreateObject("adodb.recordset")
			  SQL2 = "SELECT * FROM TB_ESTACAOFINANCEIRA WHERE CODALOCADO = " & CODIGOALOCADO
			  'Response.Write SQL2
			  'Response.End 
			  'SQL2 = SQL2 & " AND CODEQUIPAMENTO = " & request("codequipamento")
			  rs2.Open sql2,cn,3,1,1 %>
			  </table>
			  <br>
		<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="gray">
					<tr BGCOLOR=#EEEEEE>
					  <td width="10%" align="left" class=font>		
						End. Lógico
					  </td>
					  <td width="10%" align="left" class=font>		
						Marca
					  </td>
					  <td width="20%" align="left" class=font>		
						Modelo
					  </td>
					  <td width="15%" align="left" class=font>		
						N/S
					  </td>
					  <td width="15%" align="left" class=font>		
						Patrimônio
					  </td>
					  <td width="10%" align="left" class=font>		
						Excluir
					  </td>
					</tr><%
			  Do While not rs2.EOF%>
					<tr >
					  <td width="5%" align="left" class=font>		
						<%=rs2.Fields ("EQUIPAMENTO")%>
					  </td>
					  <td width="10%" align="left" class=font>		
						<%=rs2.Fields("marca")%>
					  </td>
					  <td width="20%" align="left" class=font>		
						<%=rs2.Fields("modelo")%>
					  </td>
					  <td width="15%" align="left" class=font>		
						<%=rs2.Fields ("numserie")%>
					  </td>
					  <td width="15%" align="left" class=font>		
						<%=rs2.Fields ("patrimonio")%>
					  </td>
					  <td width="10%" align="left" class=font>		
							
							  value="<%=rs2.Fields("Modelo")%>"  
							  
				 			<img width=15 height=15 border=0 src="../../Images/cancel_rd.gif" name="excluir" onclick="f_excluir()" title="Excluir" style="cursor : hand;">
					  </td>
					</tr>
				 <%rs2.MoveNext 
			  loop
			End if%>
		</table><BR>
		<%else
			IF REQUEST("strUNIDADE") <> "" THEN
			  Set rs2 = server.CreateObject("adodb.recordset")
			  SQL2 = "SELECT * FROM TB_ALOCADO WHERE CODUNIDADE = " & request("strUNIDADE")&" AND PROJETO = 2"
			  cn.execute sql2
			  rs2.Open sql2,cn,3,1,1 %>
			  </table>
			  <BR><BR>
		<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="gray">
					<tr BGCOLOR=#EEEEEE>
					  <td width="5%" align="left" class=font>		
						<B>Tipo</B>
					  </td>
					  <td width="10%" align="left" class=font>		
						<B>End. Lógico</B>
					  </td>
					  <td width="10%" align="left" class=font>		
						<B>Marca</B>
					  </td>
					  <td width="20%" align="left" class=font>		
						<B>Modelo</B>
					  </td>
					  <td width="15%" align="left" class=font>		
						<B>N/S</B>
					  </td>
					  <td width="15%" align="left" class=font>		
						<B>Patrimônio</B>
					  </td>
					</tr><%
			  Do While not rs2.EOF%>
					<tr >
					  <td width="5%" align="left" class=font>		
						<font face="Arial, Helvetica, sans-serif"><%=rs2.Fields ("Tipo")%></font>
					  </td>
					  <td width="10%" align="left" class=font>		
						<%=rs2.Fields ("endlogico")%>
					  </td>
					  <td width="10%" align="left" class=font>		
						<%=rs2.Fields ("marca")%>
					  </td>
					  <td width="20%" align="left" class=font>		
						<%=rs2.Fields ("modelo")%>
					  </td>
					  <td width="15%" align="left" class=font>		
						<%=rs2.Fields ("nserie")%>
					  </td>
					  <td width="15%" align="left" class=font>		
						<%=rs2.Fields ("patrimonio")%>
					  </td>
					</tr>
				 <%rs2.MoveNext 
			  loop
			End if%>	
				</TABLE>
				<script>
				{
				window.print();
				}
				</SCRIPT>
		<%end if' FIM DA IMPRESSAO%>
		<BR><BR>
		<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" bordercolor="gray">
		<tr align="left"> 
			  <td align="left" colspan=2 cellspacing="2" class=font>
				<b>2. Comentários adicionais:</B>
				 <td align="left">
			</tr> 
			<tr align="left"> 
				 <td colspan=3>
					<TEXTAREA id=TEXTAREA1 name=obs rows=6 cols=110><%=request("obs")%></TEXTAREA>
				 </td>
			  </td>
			</tr>
			<tr align="center" class=controle> 
				 <td colspan=3>
					<input type=button id="button" name="button" value=Gravar onclick="java script:f_questions();">
				 </td>
			  </td>
			</tr>
		</table><br>

</form>
</body>
</html>

Este é código que estou tentando enxugar , como na figura 2 q eu postei , bom fazendo isso q você postou me gera um erro:

Microsoft VBScript runtime error '800a0009'

 

Subscript out of range: '[number: 0]'

 

/Alocado/EstacaoFinanceira/Estacaofinanceira.asp, line 91

 

OBRIGADO

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ta.. mas QUAL é a linha 91??

 

Abraços...

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bom no código que estou tentando enxugar a linha 91 é esta

 

'on error resume next <- no código que postei aki está com o comentário na linha de baixo porém coloquei nesta linha aqui.

strmodelo = split(request("modelo"),"|")

modelo = strmodelo(0) <------ LINHA 91

 

 

Abraços http://forum.imasters.com.br/public/style_emoticons/default/grin.gif

Compartilhar este post


Link para o post
Compartilhar em outros sites

O campo "modelo" do form anterior estava passando uma seqüência de valores? O que acontece ali é que o Split tenta fazer uma quebra, gerando um array com o que viria desse campo, mas agora ele não gera, por isso o erro de "subscrito fora do intervalo", ele não gera array pois não existe o separador esperado para isso.

Compartilhar este post


Link para o post
Compartilhar em outros sites

/\

||

||

||

 

Sou fã desse cara!!!!

 

:unsure: OK !!!!! :blink:

 

 

heheheheh estou 3 dias tentando fazer essa coisa funcionar e estou vendo que vcs levariam minutos , hehehehehe !!!!

To ferrado :( !!!

Valeu Galera , vou pedir minhas contas , hauhhauhahuhauhuahah !!!!

abraços

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bomba,

Conseguiu fazer o que está querendo?

Essa tela, pelo que pude notar é apenas o form, não é ele que faz a inserção em si. Poste/verifique o arquivo IncluirestacaoFinanceira.asp, é nele que estará o INSERT, ou pelo menos os chamados para as StoredProcedures do seu banco.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bomba,

Conseguiu fazer o que está querendo?

Essa tela, pelo que pude notar é apenas o form, não é ele que faz a inserção em si. Poste/verifique o arquivo IncluirestacaoFinanceira.asp, é nele que estará o INSERT, ou pelo menos os chamados para as StoredProcedures do seu banco.

Olá amigo , powkra to conseguindo sim, estou demorandomais está indo, é eu vi q ele faz chamada pra este formulário INCLUIRESTACAOFINANCEIRA , dae fui lá e vi todo o INSERT , mais agora estou com outra dúvida , tipo conseguindo tiraros campos , só q tem um q qnd eu tiro ele não gera erro, parece q manda pro Banco de Dados , só q qnd vou ver no banco o registro não está lá,datudo certo , aparece até a janela d confirmação porém nao grava no banco,vou por duas figuras aki , a figura e_assim.jpg é d como o sql está com o campo q ainda nao tirei "Lacre", ou seja, ele grava no banco:

 

Imagem Postada

 

Já o figura Nao_grava_no_banco.jpg mostra o campo "Lacre" que eu quero tirar , só q qnd tiro ele ,nao grava o registro no banco :

 

Imagem Postada

 

Será q estou errando onde no sql?? Obrigado ae pela dica Salgado.

 

Abraços

Compartilhar este post


Link para o post
Compartilhar em outros sites

Verifique se antes não existe algum IF verificando se esse campo não está vindo vazio e pulando a seqüência de inserção. Outra coisa, verifique também os campos do BD. veja se todos permitem entradas nulas/vazias.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Nossa pessoal, preciso de outra ajuda , já estou conseguindo gravar os dados no banco de dados , mais agora tem outra dúvida, nesse código q colei aki , existem 3 combobox , uma atualizando a outra , porém o kra quer q eu altere esses valores , ou seja, crie uma do zero pq vai mudar todas as opções , mais tipo criei 3 tabelas diferentes e comecei a mudificar neste código a chamada delas só q mudando os nomes delas, porém está dando errado, queria saber se existe uma forma mais fácil do que essa no código pra fazer 3 combo uma atualizando a outra conforme sua opção selecionada. Ex: combo1 = País , Combo2=Estado , Combo3= Cidade , Na combo1 selecionar Brasil terá q mostrar as estados brasileiros e selecionano os estados terá q mostrar suas cidades. Tem uma maneira simples de fazer isso ??? e depois ainda salvar no banco ??

 

Obrigado.

 

Abraços

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.