Home | Advertising Info26 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Wednesday, January 15, 2025  

  Active InfoActive Info  Display List of Info MembersMemberlist  Search The InfoSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - Database Issues
 PowerASP Code Help Area : Classic ASP - Database Issues
Subject Info: updating database A d d  -  P o s tAdd P o s t
Author
Message << Prev Info | Next Info >>
mjunior
Newbie
Newbie
Avatar

Joined: November/06/2004
Location: Brazil
Online Status: Offline
Info: 27
Added: November/06/2004 at 9:41pm | IP Logged Quote mjunior

Hi guys, I'm new on asp coding so maybe I could miss something very simple to make this case work. Anyhow, I'd like to update a former table that I use to add new values with no problem at all...but the update that I'm planning is more an insert then update cause I'll need to set new values for the blank fields from the line I insert before and not for the same only changing this ones.
I tried to use the update (as suggested from tips on google) and also the same string I use to insert using (were x=y )added on it..but it didn't work. Could anyone help me, please?

__________________
mjunior(dumb)
Back to Top View mjunior's Profile Search for other info by mjunior
 
cwilliams
Admin Group
Admin Group
Avatar

Joined: April/26/2004
Location: United States
Online Status: Offline
Info: 137
Added: November/07/2004 at 8:05pm | IP Logged Quote cwilliams

This link should help.

http://www.powerasp.com/content/database/default.asp

Other than those examples you need to learn and undertand basic SQL statements. It's how you will ask the database questions, edit existing information, and add new rows of data.



Edited by cwilliams on November/07/2004 at 9:58pm


__________________


Chris Williams
http://www.PowerASP.com
Back to Top View cwilliams's Profile Search for other info by cwilliams
 
mjunior
Newbie
Newbie
Avatar

Joined: November/06/2004
Location: Brazil
Online Status: Offline
Info: 27
Added: November/07/2004 at 11:03pm | IP Logged Quote mjunior

Hi and thsnks for the wuick answer, however I didn't catch the results the exemple shows me. I tried to use the select and also the update after opening a recordset connection but it didn't work.
Could you suggest me something below?
<%


'Conexão com o BD---------------------------------------------------------- --------------------------------
Dim data_source, conBD
data_source = "DBQ=" & Server.Mappath("db1.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
Set conBD = Server.CreateObject("ADODB.Connection")
conBD.Open data_source
'----------------------------------------------------------- ---------------------------------------------

'Variaveis-------------------------------------------------- ---------------------------------------------
localID = Request.QueryString("idlinha")
'Manipulacao
Acao = Request.QueryString("Acao")

'Dados Serviço
'----------------------------------------------------------- ---------------------------------------------

datainicioag = request.form("datainicioag")
ageresponsavel = request.form("ageresponsavel")
agendavistoria = request.form("agendavistoria")
fimcadagenda = request.form("fimcadagenda")




'----------------------------------------------------------- ---------------------------------------------

%>
<font face="Verdana" size="4">
<div align="center"><b>Formulário de Agenda</b>
Referente ao ID número:
<%Response.Write (localID)%>
</h2>
<%
If IsEmpty( Request.Form("submit") ) Then
%>
</div>
<form method=post action="<%=Request.ServerVariables("script_name")%>"&g t;
<table width="60%" border=0 align=center>
<tr>
    <td width="50%" align=right valign=middle bgcolor="#00CCFF"><div align="left"><font face="Verdana" size="2">Data:</font></div></td>
    <td width="61%" align=left valign=top>
    <font face="Verdana" size="2"></font>
    <div align="left">
      <input type=text name="datainicioag" value="<%=Date()%>" size=25 maxlength=50 style="{<font-family:Verdana; font-size:12}" readonly>
    </div></td>
</tr>
    <tr>
    <td align=right valign=middle bgcolor="#00CCFF"><div align="left"><font face="Verdana" size="2">Responsável:</font></div>< /td>
    <td align=left valign=top>
      <font face="Verdana" size="2">
      <div align="left">
        <input type=text name="ageresponsavel" value="" size=25 maxlength=50 style="{<font-family:Verdana; font-size:12}">
      </div></td>
</tr>
<tr>
    <td align=right valign=middle bgcolor="#00CCFF"><div align="left"><font face="Verdana" size="2">Data agendada vistoria:</font></div></td>
    <td align=left valign=top>
      <font face="Verdana" size="2">
      <div align="left">
        <input type=text name="agendavistoria" value="" size=25 maxlength=50 style="{<font-family:Verdana; font-size:12}">
      </div></td>
</tr>
<tr>
    <td align=right valign=middle bgcolor="#00CCFF"><div align="left"><font face="Verdana" size="2">Período da vistoria : </font></div></td>
    <td align=left valign=top>
      <font face="Verdana" size="2">
      <div align="left">      </div ></td>
</tr>
<tr>
    <td bgcolor="#00CCFF"><div align="left"><font face="Verdana" size="2">Cadastro da agenda completo:</font></div></td>
    <td align=left>
      <div align="left"><font face="Verdana" size="2">
      Sim
            <input type=RADIO name="fimcadagenda" value="s" size=15 maxlength=50 style="{<font-family:Verdana; font-size:12}">
            Não
            <input type=RADIO name="fimcadagenda" value="n" size=15 maxlength=50 style="{<font-family:Verdana; font-size:12}">
        </font>
      </div></td>
</tr>
</table>
<center>
<p>     </p>
<p>
    <input type=submit name=submit value=Incluir style="{<font-family:Verdana; font-size:12}">
</p>
</center>
</form>
<%
Dim rsUpdateVendas
Set rsUpdateVendas = Server.CreateObject("ADODB.Recordset")
rsUpdateVendas.Open "SELECT tab_CadVendas.* FROM tab_CadVendas WHERE (localID = " & ID & ")",conBD,1,3

rsUpdateVendas.Fields("datainicioag") = datainicioag
rsUpdateVendas.Fields("ageresponsavel") = ageresponsavel
rsUpdateVendas.Fields("agendavistoria") = agendavistoria
rsUpdateVendas.Fields("fimcadagenda") = fimcadagenda
rsUpdateVendas.Update


%>
<%
Else
%>
   <font face="Verdana" size="2">
   <center><br>Os dados foram enviados com sucesso!

   <br><a href="javascript:history.go(-2)"><b>Clique aqui</b></a> para alterar novo registro</center>
   
<%
End if
%>


<%
conBD.Close
Set conBD = Nothing
rsUpdateVendas.Close
Set rsUpdateVendas = Nothing
%>


__________________
mjunior(dumb)
Back to Top View mjunior's Profile Search for other info by mjunior
 
cwilliams
Admin Group
Admin Group
Avatar

Joined: April/26/2004
Location: United States
Online Status: Offline
Info: 137
Added: November/07/2004 at 11:09pm | IP Logged Quote cwilliams

sorry... I dont have time to get into this..

__________________


Chris Williams
http://www.PowerASP.com
Back to Top View cwilliams's Profile Search for other info by cwilliams
 

If you wish to make a comment to this info you must first login
If you are not already registered you must first register

  A d d  -  P o s tAdd P o s t
Printable version Printable version

Info Jump
You cannot add new info in this area
You cannot add to info in this area
You cannot delete your info in this area
You cannot edit your info in this area
You cannot create polls in this area
You cannot vote in polls in this area

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2025 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

PowerASP active server pages asp.net microsoft .net framework sdk learn asp what is asp tutorial learn asp.net CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com