Jump to content
Fórum Script Brasil
  • 0

Update No Bd Access


Danilo Piovani

Question

4 answers to this question

Recommended Posts

  • 0

Então Galera , o procedimento que eu imagino é o seguinte ...

Um funcionário insere um aviso de manutenção ... ( já implementado )

dou a opção de consultar os avisos em aberto ... ( já implementado )

dentro desta página quero um botão de atualizar , que quando clicado traz todos os campos com os atuais "valores" podendo assim ser modificados e feito o update ...

Se você puder me mostrar um código simples disso eu tento colocar dentro do meu padrão ... Valeu Galera...

Link to comment
Share on other sites

  • 0

O que tem de errado neste ??

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body bgcolor="#FFFFFF" text="#000000">

<form method="post" action="<%=MM_editAction%>" name="form1">

<table align="center" width="611">

<tr valign="baseline">

<td nowrap align="left" width="193"><b>

Manutenção em:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b>

</td>

<td width="404">

<input type="text" name="nome" value="<%=(Recordset1.Fields.Item("servidor").Value)%>" size="27">

</td>

</tr>

<tr valign="baseline">

<td nowrap align="left" width="193"><b>Será(ão) Impactado(s):</b>

</td>

<td width="404">

<input type="text" name="endereco" value="<%=(Recordset1.Fields.Item("sistema").Value)%>" size="27">

</td>

</tr>

<tr valign="baseline">

<td nowrap align="left" width="193"><b>

Data da Manutenção:&nbsp;&nbsp;&nbsp;</b>

</td>

<td width="404">

<input type="text" name="cidade" value="<%=(Recordset1.Fields.Item("dia").Value)%>" size="20">

</td>

</tr>

<tr valign="baseline">

<td nowrap align="left" width="193"><b>

Hora de Início:</b>

</td>

<td width="404">

<input type="text" name="estado" value="<%=(Recordset1.Fields.Item("inicio").Value)%>" size="12">

</td>

</tr>

<tr valign="baseline">

<td nowrap align="left" width="193"><b>Tempo de Manutenção:</b>

</td>

<td width="404">

<input type="text" name="cep" value="<%=(Recordset1.Fields.Item("termino").Value)%>" size="12">

</td>

</tr>

<tr valign="baseline">

<td nowrap align="left" width="193"><b>

Autor:</b>

</td>

<td width="404">

<input type="text" name="email" value="<%=(Recordset1.Fields.Item("autor").Value)%>" size="47">

</td>

</tr>

<tr valign="baseline">

<td nowrap align="left" width="193"><b>E-mail

do Responsável:&nbsp;</b>

</td>

<td width="404">

<input type="text" name="tel1" value="<%=(Recordset1.Fields.Item("email").Value)%>" size="47">

</td>

</tr>

<tr valign="baseline">

<td nowrap align="left" width="193"><b>

Observações e Motivos:</b>

</td>

<td width="404">

<textarea TYPE="text" NAME="obs" rows="5" cols="78" value="<%=(Recordset1.Fields.Item("obs").Value)%>"></textarea>

</td>

</tr>

<tr valign="baseline">

<td nowrap align="left" width="193"></td>

<td width="404">

</td>

</tr>

<tr valign="baseline">

<td nowrap align="left" width="193">&nbsp;</td>

<td width="404">

<p align="center">

<input type="submit" value="( Atualizar )">

</p>

</td>

</tr>

</table>

<input type="hidden" name="MM_update" value="true">

<input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("codigo").Value %>">

</form>

<%@LANGUAGE="VBSCRIPT"%>

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

<%

' ******************** WWW.COMERCIALWEB.COM.BR *********************

' * Este sistema foi desenvolvido por: www.comercialweb.com.br *

' * desenvolvimentos loja virtual dominio e hospedagem. *

' * E-mail comercial@comercialweb.com.br *

' * caso tenha alguma dúvida leia o arquivo configuração.txt *

' * ou envie um E-mail: yy200@ig.com.br a/c Luciano *

' ******************************************************************

MM_editAction = CStr(Request("URL"))

If (Request.QueryString <> "") Then

MM_editAction = MM_editAction & "?" & Request.QueryString

End If

' boolean to abort record edit

MM_abortEdit = false

' query string to execute

MM_editQuery = ""

%>

<%

' *** Update Record: set variables

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

MM_editConnection = MM_avis_manut_STRING

MM_editTable = "tabela1"

MM_editColumn = "codigo"

MM_recordId = "" + Request.Form("MM_recordId") + ""

MM_editRedirectUrl = "confirma_atualizacao.asp"

MM_fieldsStr = "servidor|value|sistema|value|dia|value|inicio|value|termino|value|autor|value|email|value|obs|value"

MM_columnsStr = "|servidor|',none,''|sistema|',none,''|dia|',none,''|inicio|',none,''|termino|',none,''|autor|',none,''|email|',none,''|obs|',none,NULL"

' create the MM_fields and MM_columns arrays

MM_fields = Split(MM_fieldsStr, "|")

MM_columns = Split(MM_columnsStr, "|")

' set the form values

For i = LBound(MM_fields) To UBound(MM_fields) Step 2

MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))

Next

' append the query string to the redirect URL

If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then

If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then

MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString

Else

MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString

End If

End If

End If

%>

<%

' *** Update Record: construct a sql update statement and execute it

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

' create the sql update statement

MM_editQuery = "update " & MM_editTable & " set "

For i = LBound(MM_fields) To UBound(MM_fields) Step 2

FormVal = MM_fields(i+1)

MM_typeArray = Split(MM_columns(i+1),",")

Delim = MM_typeArray(0)

If (Delim = "none") Then Delim = ""

AltVal = MM_typeArray(1)

If (AltVal = "none") Then AltVal = ""

EmptyVal = MM_typeArray(2)

If (EmptyVal = "none") Then EmptyVal = ""

If (FormVal = "") Then

FormVal = EmptyVal

Else

If (AltVal <> "") Then

FormVal = AltVal

ElseIf (Delim = "'") Then ' escape quotes

FormVal = "'" & Replace(FormVal,"'","''") & "'"

Else

FormVal = Delim + FormVal + Delim

End If

End If

If (i <> LBound(MM_fields)) Then

MM_editQuery = MM_editQuery & ","

End If

MM_editQuery = MM_editQuery & MM_columns(i) & " = " & FormVal

Next

MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId

If (Not MM_abortEdit) Then

' execute the update

Set MM_editCmd = Server.CreateObject("ADODB.Command")

MM_editCmd.ActiveConnection = MM_editConnection

MM_editCmd.CommandText = MM_editQuery

MM_editCmd.Execute

MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "") Then

Response.Redirect(MM_editRedirectUrl)

End If

End If

End If

%>

<%

Dim Recordset1__Codigo

Recordset1__Codigo = "0"

if (request.querystring("tabela1") <> "") then Recordset1__Codigo = request.querystring("tabela1")

%>

<%

set Recordset1 = Server.CreateObject("ADODB.Recordset")

Recordset1.ActiveConnection = MM_avis_manut_STRING

Recordset1.Source = "SELECT codigo , servidor, sistema, dia , inicio, termino, autor, email, obs FROM tabela1 WHERE codigo = " + Replace(Recordset1__Codigo, "'", "''") + ""

Recordset1.CursorType = 0

Recordset1.CursorLocation = 2

Recordset1.LockType = 3

Recordset1.Open()

Recordset1_numRows = 0

%>

<p>&nbsp;</p>

</body>

</html>

<%Recordset1.Close()%>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...