Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá Pessoal, to desenvolvendo um sistema envolvendo asp + sql server, já fiz a parte de consulta,exclusão e cadastro, só falta a parte de editar o fornecedor.... Porém estou com problemas em levar uma varivael para servir de parametro para a tela de edição, vocês podem me ajudar?????
O nome da tela de edição é
>
'Nome da página de alteração
pagina_alteracao = "frm_editforncpf.asp"
Quando tento receber uma variavel para poder trabalhar na pagina de edição não vem nada...
>
strQ = Request.Form("strQ")
indice = Trim(Request.Form("indice"))
response.Write Request.Form("strQ")
response.Write Request.Form("indice")
response.End()
A strQ traz a informação legal, mas o indice não ta funcionando ... na verdade preciso levar somente o campo for_cgccpf, com ele faço toda a brincadeira... Alguém sabe como posso levar este campo para uma outra página, com base no código abaixo...
PS.: estou reaproveitando um trabalho de uma amigo aqui da Empresa, daí minha dúvida na parte de editar o fornecedor!!!
Grato por qq ajuda...
ASP
<fieldset><legend>Consultar Fornecedores - Pessoa Física</legend><%
If Request.QueryString("PagAtual") = "" Then
PagAtual = 1
NumPagMax = VarPagMax
Else
NumPagMax = CInt(Request.QueryString("NumPagMax"))
PagAtual = CInt(Request.QueryString("PagAtual"))
Select Case Request.QueryString("Submit")
Case "Anterior" : PagAtual = PagAtual - 1
Case "Proxima" : PagAtual = PagAtual + 1
Case "Menos" : NumPagMax = NumPagMax - VarPagMax
Case "Mais" : NumPagMax = NumPagMax + VarPagMax
Case Else : PagAtual = CInt(Request.QueryString("Submit"))
End Select
If NumPagMax < PagAtual then
NumPagMax = NumPagMax + VarPagMax
End If
If NumPagMax - (VarPagMax - 1) > PagAtual then
NumPagMax = NumPagMax - VarPagMax
End If
End If
Set objCon = Server.CreateObject("ADODB.Connection")
objCon.Open strCon
If Request.Form("recordno") <> "" Then
Set objRS_delete = Server.CreateObject("ADODB.Recordset")
objRS_delete.CursorLocation = 3
objRS_delete.CursorType = 0
objRS_delete.LockType = 3
strQ_delete = Request.Form("strQ")
indice = Trim(Request.Form("indice"))
If indice <> "" Then strQ_delete = " SELECT * FROM fornecedor WHERE " & indice
objRS_delete.Open strQ_delete, objCon, , , &H0001
If indice = "" Then objRS_delete.Move Request.Form("recordno") - 1
If Not objRS_delete.EOF Then
objRS_delete.Delete
objRS_delete.UpdateBatch
End IF
objRS_delete.Close
Set objRS_delete = Nothing
Set strQ_delete = Nothing
End If
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.CursorLocation = 3
objRS.CursorType = 2
objRS.LockType = 1
objRS.CacheSize = RegPorPag
strQ = "SELECT * FROM fornecedor where for_tipopessoa = 'F'"
If Trim(Request("string_busca")) <> "" Then
If Trim(Request("campo_busca")) <> "" Then
strQ = strQ & " and " & Trim(Request("campo_busca")) & " LIKE '%" & Trim(Request("string_busca")) & "%'"
Else
strQ = strQ & " Where 1 <> 1"
strQ = strQ & " Or for_cgccpf LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or for_nome LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or for_uf LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or for_inscr_estadual LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or for_inscr_inss LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or for_pis_pasep LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or for_inscr_municipal LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or for_cbo LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or for_categ LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or for_ocorr LIKE '%" & Trim(Request("string_busca")) & "%'"
End If
End If
If Trim(Request.QueryString("Ordem")) <> "" Then
strQ = strQ & " ORDER BY " & Request.QueryString("Ordem")
End If
objRS.Open strQ, objCon, , , &H0001
objRS.PageSize = RegPorPag
Set objRS_indice = Server.CreateObject("ADODB.Recordset")
objRS_indice.CursorLocation = 2
objRS_indice.CursorType = 0
objRS_indice.LockType = 2
strQ_indice = "SELECT * FROM fornecedor WHERE 1 <> 1"
objRS_indice.Open strQ_indice, objCon, , , &H0001
indice = ""
For Each item In objRS_indice.Fields
If item.properties("IsAutoIncrement") = True Then
indice = item.name
Exit For
End If
Next
objRS_indice.Close
Set objRS_indice = Nothing
Set strQ_indice = Nothing
Set objRS.ActiveConnection = Nothing
objCon.Close
Set objCon = Nothing
%>
<FORM name="form_busca" method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
Pesquizar por <INPUT type=text name=string_busca value="<%=Request("string_busca")%>" class=texto_pagina> em
<SELECT name=campo_busca class=texto_pagina>
<OPTION value="" selected>Registros</OPTION>
<OPTION value="for_cgccpf" <% If Trim(Request("campo_busca")) = Trim("for_cgccpf") Then : Response.Write "selected" : End If %>>CPF</OPTION>
<OPTION value="for_nome" <% If Trim(Request("campo_busca")) = Trim("for_nome") Then : Response.Write "selected" : End If %>>Nome</OPTION>
<OPTION value="for_uf" <% If Trim(Request("campo_busca")) = Trim("for_uf") Then : Response.Write "selected" : End If %>>UF</OPTION>
<OPTION value="for_inscr_estadual" <% If Trim(Request("campo_busca")) = Trim("for_inscr_estadual") Then : Response.Write "selected" : End If %>>Inscr. Estadual</OPTION>
<OPTION value="for_inscr_inss" <% If Trim(Request("campo_busca")) = Trim("for_inscr_inss") Then : Response.Write "selected" : End If %>>Inscr. Inss</OPTION>
<OPTION value="for_pis_pasep" <% If Trim(Request("campo_busca")) = Trim("for_pis_pasep") Then : Response.Write "selected" : End If %>>Inscr. Pis / Pasep</OPTION>
<OPTION value="for_inscr_municipal" <% If Trim(Request("campo_busca")) = Trim("for_inscr_municipal") Then : Response.Write "selected" : End If %>>Inscr. Municipal</OPTION>
<OPTION value="for_cbo" <% If Trim(Request("campo_busca")) = Trim("for_cbo") Then : Response.Write "selected" : End If %>>CBO</OPTION>
<OPTION value="for_categ" <% If Trim(Request("campo_busca")) = Trim("for_categ") Then : Response.Write "selected" : End If %>>Categoria</OPTION>
<OPTION value="for_ocorr" <% If Trim(Request("campo_busca")) = Trim("for_ocorr") Then : Response.Write "selected" : End If %>>Ocorrência</OPTION>
</SELECT>
<INPUT type="submit" name="submit" value="ok" class=texto_pagina style="color: black">
</FORM>
<%
If Not(objRS.EOF) Then
objRS.AbsolutePage = PagAtual
TotPag = objRS.PageCount
%>
Foram encontrados <%= objRS.RecordCount%> registros<BR><BR>
<TABLE border=0 cellpadding=2 cellspacing=1 class="borda" >
<TR bgcolor="gainsboro" class="textosleft">
<%
Response.Write "<TD align=""center"" style=""background-color: crimson; color: white"" width=""1%"" nowrap><b>Excluir?</b></TD>"
If Right(Request.QueryString("Ordem"), 3) = "asc" Then
Ordem = "desc"
Else
Ordem = "asc"
End IF
%>
<TD style="cursor: hand" valign=top nowrap onClick="window.open('<%=Request.ServerVariables("SCRIPT_NAME")%>?Ordem=for_cgccpf+<%=Ordem%>', '_self')"><%If Left(Request.QueryString("Ordem"), 10) = "for_cgccpf" Then : Response.Write "<img src=""imagesordem_" & Ordem & ".gif"" width=9 height=10> " : End If%><b>C. P. F.</b></TD>
<TD style="cursor: hand" valign=top nowrap onClick="window.open('<%=Request.ServerVariables("SCRIPT_NAME")%>?Ordem=for_nome+<%=Ordem%>', '_self')"><%If Left(Request.QueryString("Ordem"), 8) = "for_nome" Then : Response.Write "<img src=""imagesordem_" & Ordem & ".gif"" width=9 height=10> " : End If%><b>Nome</b></TD>
<TD style="cursor: hand" valign=top nowrap onClick="window.open('<%=Request.ServerVariables("SCRIPT_NAME")%>?Ordem=for_uf+<%=Ordem%>', '_self')"><%If Left(Request.QueryString("Ordem"), 6) = "for_uf" Then : Response.Write "<img src=""imagesordem_" & Ordem & ".gif"" width=9 height=10> " : End If%><b>UF</b></TD>
<TD style="cursor: hand" valign=top nowrap onClick="window.open('<%=Request.ServerVariables("SCRIPT_NAME")%>?Ordem=for_inscr_estadual+<%=Ordem%>', '_self')"><%If Left(Request.QueryString("Ordem"), 18) = "for_inscr_estadual" Then : Response.Write "<img src=""imagesordem_" & Ordem & ".gif"" width=9 height=10> " : End If%><b>Inscr. Estadual</b></TD>
<TD style="cursor: hand" valign=top nowrap onClick="window.open('<%=Request.ServerVariables("SCRIPT_NAME")%>?Ordem=for_inscr_inss+<%=Ordem%>', '_self')"><%If Left(Request.QueryString("Ordem"), 14) = "for_inscr_inss" Then : Response.Write "<img src=""imagesordem_" & Ordem & ".gif"" width=9 height=10> " : End If%><b>Inscr. Inss</b></TD>
<TD style="cursor: hand" valign=top nowrap onClick="window.open('<%=Request.ServerVariables("SCRIPT_NAME")%>?Ordem=for_pis_pasep+<%=Ordem%>', '_self')"><%If Left(Request.QueryString("Ordem"), 13) = "for_pis_pasep" Then : Response.Write "<img src=""imagesordem_" & Ordem & ".gif"" width=9 height=10> " : End If%><b>Pis / Pasep</b></TD>
<TD style="cursor: hand" valign=top nowrap onClick="window.open('<%=Request.ServerVariables("SCRIPT_NAME")%>?Ordem=for_inscr_municipal+<%=Ordem%>', '_self')"><%If Left(Request.QueryString("Ordem"), 19) = "for_inscr_municipal" Then : Response.Write "<img src=""imagesordem_" & Ordem & ".gif"" width=9 height=10> " : End If%><b>Inscr. Municipal</b></TD>
<TD style="cursor: hand" valign=top nowrap onClick="window.open('<%=Request.ServerVariables("SCRIPT_NAME")%>?Ordem=for_cbo+<%=Ordem%>', '_self')"><%If Left(Request.QueryString("Ordem"), 7) = "for_cbo" Then : Response.Write "<img src=""imagesordem_" & Ordem & ".gif"" width=9 height=10> " : End If%><b>C. B. O.</b></TD>
<TD style="cursor: hand" valign=top nowrap onClick="window.open('<%=Request.ServerVariables("SCRIPT_NAME")%>?Ordem=for_categ+<%=Ordem%>', '_self')"><%If Left(Request.QueryString("Ordem"), 9) = "for_categ" Then : Response.Write "<img src=""imagesordem_" & Ordem & ".gif"" width=9 height=10> " : End If%><b>Categoria</b></TD>
<TD style="cursor: hand" valign=top nowrap onClick="window.open('<%=Request.ServerVariables("SCRIPT_NAME")%>?Ordem=for_ocorr+<%=Ordem%>', '_self')"><%If Left(Request.QueryString("Ordem"), 9) = "for_ocorr" Then : Response.Write "<img src=""imagesordem_" & Ordem & ".gif"" width=9 height=10> " : End If%><b>Ocorrência</b></TD>
</TR>
<%
For Cont = 1 to objRS.PageSize
%>
<TR class=exibe_registros onMouseOver="this.style.backgroundColor='<%=cor_linha_selecionada%>';" onMouseOut="this.style.backgroundColor='';">
<%
Response.Write "<FORM name=""form_edit_" & Cont & """ action=""" & pagina_alteracao & """ method=post>"
Response.Write "<TD align=""center"" nowrap style=""background-color: gainsboro"" nowrap> "
If indice <> "" Then Response.Write "<input type=""hidden"" name=""indice"" value=""" & indice & "=" & objRS.Fields.Item(indice).Value & """>"
Response.Write "<INPUT type=hidden name=recordno value=""" & (objRS.AbsolutePosition) & """>"
Response.Write "<INPUT type=hidden name=strQ value=""" & strQ & """>"
Response.Write "<INPUT type=image src=""imagesedit.gif"" alt=""Alterar Registro"" name=alterar value=alterar>"
Response.Write " <IMG src=""imagesdelete.gif"" alt=""Excluir Registro"" name=delete border=0 style=""cursor:hand"" OnClick=""confirm_delete('form_edit_" & Cont & "')"">"
Response.Write " </TD>"
Response.Write "</FORM>"
%>
<TD><%=(objRS.Fields.Item("for_cgccpf").Value)%></TD>
<TD><%=(objRS.Fields.Item("for_nome").Value)%></TD>
<TD><%=(objRS.Fields.Item("for_uf").Value)%></TD>
<TD><%=(objRS.Fields.Item("for_inscr_estadual").Value)%></TD>
<TD><%=(objRS.Fields.Item("for_inscr_inss").Value)%></TD>
<TD><%=(objRS.Fields.Item("for_pis_pasep").Value)%></TD>
<TD><%=(objRS.Fields.Item("for_inscr_municipal").Value)%></TD>
<TD><%=(objRS.Fields.Item("for_cbo").Value)%></TD>
<TD><%=(objRS.Fields.Item("for_categ").Value)%></TD>
<TD><%=(objRS.Fields.Item("for_ocorr").Value)%></TD>
</TR>
<%
objRS.MoveNext
If objRS.Eof then Exit For
Next
Set Cont = Nothing
%>
Carregando comentários...