Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Format a formpagetablefield

Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25
Share This Thread →
  1. #16
    Klaus Muller is offline Contributing User
    Join Date
    Sep 2006
    Posts
    234
    Rep Power
    8
    Quote Originally Posted by Guddu
    remove this code .
    and try to add new record.

    Response.write SqlStr
    response .End
    I removed this code:

    Code:
    SqlStr = "Insert Into contactos_1001" + FieldStr + ValueStr
    Response.write SqlStr
    response .End
    I opened the page, but it opens immidiately to enter a new record.
    I filled in all fields and its working .
    I filled in a few fields and set one drop down box to SI. I got some illigal assignment (which I repaired).
    Afterwards I got the error:
    ADODB.Connection.1 error '80004005'

    SQLState: 07001
    Native Error Code: -3010
    [INTERSOLV][ODBC 20101 driver][ACCESS][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.


    /salespersonal/1001/contactos_1001form.asp, line 88


    Line 88 is:
    conntemp.Execute (SqlStr)

  2. #17
    Guddu's Avatar
    Guddu is offline Contributing User
    Join Date
    Jul 2005
    Location
    Oxford UK
    Posts
    3,897
    Rep Power
    988
    post your current code here.
    r u sure u changed the datatype of field to text.send me zip of your database with data in table.rite now i think your table has 5 records.so keep that record as it is and attached here .
    Nothing is Impossible bcoz IMPOSSIBLE itself says..
    I M POSSIBLE........................
    Be cool !!!!!!!!

  3. #18
    Klaus Muller is offline Contributing User
    Join Date
    Sep 2006
    Posts
    234
    Rep Power
    8
    Quote Originally Posted by Guddu
    post your current code here.
    r u sure u changed the datatype of field to text.send me zip of your database with data in table.rite now i think your table has 5 records.so keep that record as it is and attached here .
    The code is:

    Code:
    <!--#include File ="globalsub.asp"-->
    <%
    server.scripttimeout = 900
    'On Error Resume Next
    cmd = Request.QueryString("cmd")
    Session("autonumber") = Request.QueryString("autonumber")
    Session("autonumber") = Replace(session("autonumber"),"%2D","-")
    
    Set conntemp = server.CreateObject("adodb.Connection")
    conntemp.open "DSN=access;Database=f:\www.bellfield-barna.com\salespersonal\websales.mdb"
    
    Function CountRecs(TableName, FieldName, NoOfRecs)
    SqlStrCount = "Select Count(" + FieldName + ") As NoOfRecs From " + TableName
    Set rscount = conntemp.Execute(SqlStrCount)
    NoOfRecs = rscount("NoOfRecs")
    CountRecs = A
    rscount.Close
    End Function
    
    Select Case cmd
    
    Case "SaveNew"
    FieldStr=" ("
    ValueStr = " VALUES ("
    If Request.QueryString("prefix")<>"" Then
    FieldStr=FieldStr+ "prefix, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("prefix"))+"', "
    End if
    If Request.QueryString("firstname")<>"" Then
    FieldStr=FieldStr+ "firstname, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("firstname"))+"', "
    End if
    If Request.QueryString("lastname")<>"" Then
    FieldStr=FieldStr+ "lastname, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("lastname"))+"', "
    End if
    If Request.QueryString("additional")<>"" Then
    FieldStr=FieldStr+ "additional, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("additional"))+"', "
    End if
    If Request.QueryString("streetandnumber")<>"" Then
    FieldStr=FieldStr+ "streetandnumber, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("streetandnumber"))+"', "
    End if
    If Request.QueryString("postalcode")<>"" Then
    FieldStr=FieldStr+ "postalcode, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("postalcode"))+"', "
    End if
    If Request.QueryString("city")<>"" Then
    FieldStr=FieldStr+ "city, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("city"))+"', "
    End if
    If Request.QueryString("country")<>"" Then
    FieldStr=FieldStr+ "country, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("country"))+"', "
    End if
    If Request.QueryString("telephone")<>"" Then
    FieldStr=FieldStr+ "telephone, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("telephone"))+"', "
    End if
    If Request.QueryString("mobilephone")<>"" Then
    FieldStr=FieldStr+ "mobilephone, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("mobilephone"))+"', "
    End if
    If Request.QueryString("fax")<>"" Then
    FieldStr=FieldStr+ "fax, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("fax"))+"', "
    End if
    If Request.QueryString("email")<>"" Then
    FieldStr=FieldStr+ "email, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("email"))+"', "
    End if
    If Request.QueryString("sendbrochure")<>"" Then
    FieldStr=FieldStr+ "sendbrochure, "
    ValueStr=ValueStr+Request.QueryString("sendbrochure")+", "
    End if
    If Request.QueryString("sendpostvisit")<>"" Then
    FieldStr=FieldStr+ "sendpostvisit, "
    ValueStr=ValueStr+Request.QueryString("sendpostvisit")+", "
    End if
    If Request.QueryString("Informaciön")<>"" Then
    FieldStr=FieldStr+ "Informaciön, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("Informaciön"))+"', "
    End if
    FieldStr = Mid(FieldStr, 1, Len(FieldStr) - 2) + ")"
    ValueStr = Mid(ValueStr, 1, Len(ValueStr) - 2) + ")"
    SqlStr = "Insert Into contactos_1001" + FieldStr + ValueStr
    conntemp.Execute (SqlStr)
    conntemp.Close
    Set conntemp = Nothing
    If Err <> 0 Then
    Session("Err") = Err.Number
    Session("Description") = Err.Description
    Session("HelpContext") = Err.HelpContext
    Session("HelpFile;") = Err.HelpFile
    Session("Source") = Err.Source
    For Each Item In request.querystring
    Session(Item) = request.querystring(Item)
    Next
    response.redirect "contactos_1001form.asp?"+ Replace(request.querystring, "SaveNew", "Copy")
    End If
    response.redirect "contactos_1001form.asp?cmd=Last"
    
    Case "Save"
    SqlStr = "UPDATE contactos_1001 SET "
    If Request.QueryString("prefix") <> Session("prefix") OR IsNull(Session("prefix"))=true Then
    Sqlstr=SqlStr+"prefix='"+FixDbFieldSave(Request.QueryString("prefix")) + "', "
    End if
    If Request.QueryString("firstname") <> Session("firstname") OR IsNull(Session("firstname"))=true Then
    Sqlstr=SqlStr+"firstname='"+FixDbFieldSave(Request.QueryString("firstname")) + "', "
    End if
    If Request.QueryString("lastname") <> Session("lastname") OR IsNull(Session("lastname"))=true Then
    Sqlstr=SqlStr+"lastname='"+FixDbFieldSave(Request.QueryString("lastname")) + "', "
    End if
    If Request.QueryString("additional") <> Session("additional") OR IsNull(Session("additional"))=true Then
    Sqlstr=SqlStr+"additional='"+FixDbFieldSave(Request.QueryString("additional")) + "', "
    End if
    If Request.QueryString("streetandnumber") <> Session("streetandnumber") OR IsNull(Session("streetandnumber"))=true Then
    Sqlstr=SqlStr+"streetandnumber='"+FixDbFieldSave(Request.QueryString("streetandnumber")) + "', "
    End if
    If Request.QueryString("postalcode") <> Session("postalcode") OR IsNull(Session("postalcode"))=true Then
    Sqlstr=SqlStr+"postalcode='"+FixDbFieldSave(Request.QueryString("postalcode")) + "', "
    End if
    If Request.QueryString("city") <> Session("city") OR IsNull(Session("city"))=true Then
    Sqlstr=SqlStr+"city='"+FixDbFieldSave(Request.QueryString("city")) + "', "
    End if
    If Request.QueryString("country") <> Session("country") OR IsNull(Session("country"))=true Then
    Sqlstr=SqlStr+"country='"+FixDbFieldSave(Request.QueryString("country")) + "', "
    End if
    If Request.QueryString("telephone") <> Session("telephone") OR IsNull(Session("telephone"))=true Then
    Sqlstr=SqlStr+"telephone='"+FixDbFieldSave(Request.QueryString("telephone")) + "', "
    End if
    If Request.QueryString("mobilephone") <> Session("mobilephone") OR IsNull(Session("mobilephone"))=true Then
    Sqlstr=SqlStr+"mobilephone='"+FixDbFieldSave(Request.QueryString("mobilephone")) + "', "
    End if
    If Request.QueryString("fax") <> Session("fax") OR IsNull(Session("fax"))=true Then
    Sqlstr=SqlStr+"fax='"+FixDbFieldSave(Request.QueryString("fax")) + "', "
    End if
    If Request.QueryString("email") <> Session("email") OR IsNull(Session("email"))=true Then
    Sqlstr=SqlStr+"email='"+FixDbFieldSave(Request.QueryString("email")) + "', "
    End if
    If Request.QueryString("sendbrochure")<>"" Then
    FieldStr=FieldStr+ "sendbrochure, "
    ValueStr=ValueStr+"'"+Request.QueryString("sendbrochure")+"', "
    End if
    If Request.QueryString("sendpostvisit")<>"" Then
    FieldStr=FieldStr+ "sendpostvisit, "
    ValueStr=ValueStr+"'"+Request.QueryString("sendpostvisit")+"', "
    End if
    If Request.QueryString("Informaciön") <> Session("Informaciön") OR IsNull(Session("Informaciön"))=true Then
    Sqlstr=SqlStr+"Informaciön='"+FixDbFieldSave(Request.QueryString("Informaciön")) + "', "
    End if
    SqlStr = Mid(SqlStr, 1, Len(SqlStr) - 2)
    SqlStr = SqlStr + " WHERE autonumber="+ session("autonumber")+ " "
    If Instr(sqlstr," SE ")<=0 Then
    conntemp.Execute (SqlStr)
    End if
    SqlStr ="SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    a = 1
    While rs.EOF <> True And a < Session("CurRec")
    a = a + 1
    rs.MoveNext
    Wend
    
    Case ""
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    If rs.EOF = True Then
    Response.redirect "contactos_1001form.asp?cmd=New"
    End If
    CountRecs "contactos_1001", "autonumber", A
    Session("NumOfRecs") = a
    Session("CurRec") = 1
    
    Case "First"
    CountRecs "contactos_1001", "autonumber", A
    Session("NumOfRecs") = a
    Session("CurRec") = 1
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    
    Case "Last"
    CountRecs "contactos_1001", "autonumber", A
    Session("CurRec") = a
    Session("NumOfRecs") = a
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    a = 1
    While (a < Session("NumOfRecs")) And (rs.EOF <> True)
    a = a + 1
    rs.MoveNext
    Wend
    
    Case "Prev"
    CountRecs "contactos_1001", "autonumber", A
    Session("NumOfRecs") = a
    Session("CurRec") = Session("CurRec") - 1
    If Session("CurRec") <= 0 Then
    Session("CurRec") = Session("NumOfRecs")
    End If
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    a = 1
    While rs.EOF <> True And a < Session("CurRec")
    a = a + 1
    rs.MoveNext
    Wend
    
    Case "Next"
    CountRecs "contactos_1001", "autonumber", A
    Session("NumOfRecs") = a
    Session("CurRec") = Session("CurRec") + 1
    If Session("CurRec") > Session("NumOfRecs") Then
    Session("CurRec") = 1
    End If
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    a = 1
    While rs.EOF <> True And a < Session("CurRec")
    a = a + 1
    rs.MoveNext
    Wend
    
    Case "Del"
    SqlStr = "DELETE FROM contactos_1001 WHERE autonumber="+ Session("autonumber")
    conntemp.Execute (SqlStr)
    conntemp.Close
    Set conntemp = Nothing
    response.redirect "contactos_1001form.asp"
    
    Case "Fromlist"
    Session("CurRec") = 1
    SqlStr1 = "SELECT Count(autonumber) As TotalCount From contactos_1001"
    Set Rs1 = conntemp.Execute(SqlStr1)
    Session("NumOfRecs") = Rs1("TotalCount")
    Rs1.Close
    Set Rs1 = Nothing
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    While Trim(Session("autonumber")) <> Trim(CStr(rs("autonumber")))
    Session("CurRec") = Session("CurRec") + 1
    rs.MoveNext
    Wend
    End Select
    
    If cmd <> "New" And cmd<>"Copy" Then
    Session("autonumber") = server.Urlencode(rs("autonumber"))
    Session("prefix") = rs("prefix")
    Session("firstname") = rs("firstname")
    Session("lastname") = rs("lastname")
    Session("additional") = rs("additional")
    Session("streetandnumber") = rs("streetandnumber")
    Session("postalcode") = rs("postalcode")
    Session("city") = rs("city")
    Session("country") = rs("country")
    Session("telephone") = rs("telephone")
    Session("mobilephone") = rs("mobilephone")
    Session("fax") = rs("fax")
    Session("email") = rs("email")
    Session("sendbrochure") = rs("sendbrochure")
    Session("sendpostvisit") = rs("sendpostvisit")
    Session("Informaciön") = rs("Informaciön")
    rs.Close
    Set rs = Nothing
    End if
    
    If cmd="New" Then
    Session("autonumber") = ""
    Session("prefix") = ""
    Session("firstname") = ""
    Session("lastname") = ""
    Session("additional") = ""
    Session("streetandnumber") = ""
    Session("postalcode") = ""
    Session("city") = ""
    Session("country") = ""
    Session("telephone") = ""
    Session("mobilephone") = ""
    Session("fax") = ""
    Session("email") = ""
    Session("sendbrochure") = "False"
    Session("sendpostvisit") = "False"
    Session("Informaciön") = ""
    End If
    conntemp.Close
    Set conntemp = Nothing
    %>
    <html>
    <head><head><SCRIPT LANGUAGE="Javascript"><!--
    // ***********************************************
    
    // ***********************************************
    var isNS = (navigator.appName == "Netscape") ? 1 : 0;
    var EnableRightClick = 0;
    if(isNS) 
    document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
    function mischandler(){
      if(EnableRightClick==1){ return true; }
      else {return false; }
    }
    function mousehandler(e){
      if(EnableRightClick==1){ return true; }
      var myevent = (isNS) ? e : event;
      var eventbutton = (isNS) ? myevent.which : myevent.button;
      if((eventbutton==2)||(eventbutton==3)) return false;
    }
    function keyhandler(e) {
      var myevent = (isNS) ? e : window.event;
      if (myevent.keyCode==96)
        EnableRightClick = 1;
      return;
    }
    document.oncontextmenu = mischandler;
    document.onkeypress = keyhandler;
    document.onmousedown = mousehandler;
    document.onmouseup = mousehandler;
    //-->
    </SCRIPT>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="ATAF Version 6.1.0">
    <title>Contactos_1001</title>
    <base target="_self">
    <link rel="stylesheet" type="text/css" href="globalcss.css">
    
    <script Language="JavaScript">
    function winopenexcel (sqlstr) 
    { 
    msg=open("","NewWindow","toolbar=no,location=no,directories=no,status=no,me       nubar=yes,scrollbars=yes,resizable=yes,copyhistory       =no,width=400,height=150"); 
    msg.location = "toexcel.asp?sqlstr="+sqlstr;
    msg.focus()
    }
    </script>
    
    </head>
    <body class="formpage" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" style="background-color: #DFDFDF">
    <table width="283" border="0" height="399">
    <tr>
    <td></tr>
    <td></tr>
    <td height="2"></td>
    </tr>
    <tr>
    <td></td>
    <td align="left"><img border="0" src="../../../BIE/images/c1_top.GIF" width="267" height="17"></td>
    <td height="21"></td>
    </tr>
    <tr>
    <td></td>
    <td valign="Default" >
    <form method="GET" action="contactos_1001form.asp" name="contactos_1001" onSubmit="return Checkform(this);">
    <table border="0" cellpadding="0" cellspacing="0" class="formpagetable" width="265" style="border-width: 0">
    <tr>
    <td colspan="2">
    <table width="100%" border="0">
    
    </table>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106" height="19">&nbsp;Tratamiento</td>
    <td width="164" height="19"><input class="formpagetablefield" name="prefix" size="30" Value="<%=trim(Session("prefix"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Nombre</td>
    <td width="164"><input class="formpagetablefield" name="firstname" size="30" Value="<%=trim(Session("firstname"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Apellido(s)</td>
    <td width="164"><input class="formpagetablefield" name="lastname" size="30" Value="<%=trim(Session("lastname"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Adicional</td>
    <td width="164"><input class="formpagetablefield" name="additional" size="30" Value="<%=trim(Session("additional"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Calle y Numero</td>
    <td width="164"><input class="formpagetablefield" name="streetandnumber" size="30" Value="<%=trim(Session("streetandnumber"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Codigo Postal</td>
    <td width="164"><input class="formpagetablefield" name="postalcode" size="30" Value="<%=trim(Session("postalcode"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Ciudad</td>
    <td width="164"><input class="formpagetablefield" name="city" size="30" Value="<%=trim(Session("city"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Pais</td>
    <td width="164"><input class="formpagetablefield" name="country" size="30" Value="<%=trim(Session("country"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Teléfono</td>
    <td width="164"><input class="formpagetablefield" name="telephone" size="30" Value="<%=trim(Session("telephone"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Teléfono movil</td>
    <td width="164"><input class="formpagetablefield" name="mobilephone" size="30" Value="<%=trim(Session("mobilephone"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Fax</td>
    <td width="164"><input class="formpagetablefield" name="fax" size="30" Value="<%=trim(Session("fax"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;E-mail</td>
    <td width="164"><input class="formpagetablefield" name="email" size="30" Value="<%=trim(Session("email"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Envíe folleto</td>
    <td class="formpagetablelabel" width="164">
    <%
    Response.write CreateYesNo("Si","No","Si","No","sendbrochure",Session("sendbrochure"),"No", "class='formpagetablefield'")
    %>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Carta de postvisita</td>
    <td class="formpagetablelabel" width="164">
    <%
    Response.write CreateYesNo("Si","No","Si","No","sendpostvisit",Session("sendpostvisit"),"No", "class='formpagetablefield'")
    %>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" height="25" width="106">&nbsp;Informaciön</td>
    <td height="25" width="164"><input class="formpagetablefield" name="Informaciön" size="30" Value="<%=trim(Session("Informaciön"))%>" style="float: right"></td>
    </tr>
    <tr><td align="center" colspan="3">
    <p>
    <% If cmd<>"New" And cmd<>"Copy" Then %>
    <input type="button" value="¦<" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=First&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para ir al primer registro")%> Class="formpagebutton">
    <input type="button" value="<<" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=Prev&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Mueva un registro hacia atrás")%> Class="formpagebutton">
    <input type="text" size="8" Value="<%=Session("CurRec")%> de <%=Session("NumOfRecs")%>" Class="formpagebutton">
    <input type="button" value=">>" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=Next&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para ir para registrar después")%> Class="formpagebutton">
    <input type="button" value=">¦" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=Last&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para ir al último registro")%> Class="formpagebutton">
    <p>
    
    <input type="submit" value="Ahorrar" <%=ShowTextOnPic("Chasquido aquí para salvar sus cambios")%> Class="formpagebutton">
    <input type="button" value="Borrar" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=Del&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para borrar el registro corriente")%> Class="formpagebutton">
    <input type="button" value="Nuevo" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=New&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para crear un nuevo registro")%> Class="formpagebutton" style="float: right">
    
    <input type="hidden" name="autonumber" value="<%=session("autonumber")%>">
    <input type="Hidden"name="cmd" value="Save">
    <% Else %>
    <input type="submit" value="Ahorrar" <%=ShowTextOnPic("Chasquido para salvar el nuevo registro")%> Class="formpagebutton">
    <input type="button" value="Anular" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp'" <%=ShowTextOnPic("Chasquido para anular creación de un nuevo registro")%> Class="formpagebutton">
    <input type="hidden" name="cmd" value="SaveNew">
    <%End If %>
    </td></tr>
    <tr><td align="center" colspan="3" Height="1"></td></tr>
    </table>
    
    </form>
    </td>
    
    <td height="364"></td>
    </tr>
    <tr>
    <td width="2"></td>
    <td width="267"></td>
    <td height="2" width="0"></td>
    </tr>
    </table>
    <script language="JavaScript">
    <!--
    function Checkform(thisform) {
    // Init val
    strError = 'ATAF Version 6.1.0, Database : contactos_1001\n\nYou have to correct the following error(s)\nbefore you can save your record !!.\n\n';
    intError = 0;
    if (intError == 1) {
    alert (strError)
    return false;
    }
    }
    // -->
    </script>
    <%
    If Err <> 0 Then
    pad="Sql Script Errors Occured!\n"
    pad = pad + "Error Number= #" & Err.Number & "\n"
    pad = pad + "Error Desc.= " & Err.Description &"\n\n"
    pad = pad + "Data not saved !!!\n"
    pad=Replace(pad,"'","´")
    response.write "<script language="+qu+"JavaScript"+qu+">"+CrLf
    response.write "<!--"+CrLf
    response.write "strError = '"+pad+"';"+Crlf
    response.write "alert (strError);"+CrLf
    response.write "// -->"+CrLf
    response.write "</script>"+CrLf
    End If
    
    If Session("Err") <> 0 Then
    pad="Sql Script Errors Occured!\n"
    pad=pad + "Error Number= #<b>" & Session("Err") & "\n"
    pad=pad + "Error Desc.= <b>" & Session("Description") &"\n\n"
    pad = pad + "Data not saved !!!\n"
    pad=Replace(pad,"'","´")
    response.write "<script language="+qu+"JavaScript"+qu+">"+CrLf
    response.write "<!--"+CrLf
    response.write "strError = '"+pad+"';"+Crlf
    response.write "alert (strError);"+CrLf
    response.write "// -->"+CrLf
    response.write "</script>"+CrLf
    Session("Err")=0
    End If
    %>
    
    </body>
    </html>
    The DB is attached.
    Thanks
    Klaus
    Attached Files Attached Files

  4. #19
    Klaus Muller is offline Contributing User
    Join Date
    Sep 2006
    Posts
    234
    Rep Power
    8
    Quote Originally Posted by Guddu
    post your current code here.
    r u sure u changed the datatype of field to text.send me zip of your database with data in table.rite now i think your table has 5 records.so keep that record as it is and attached here .

    Sorry, send the wrong Zip before. Here is the correct one.
    Attached Files Attached Files

  5. #20
    Guddu's Avatar
    Guddu is offline Contributing User
    Join Date
    Jul 2005
    Location
    Oxford UK
    Posts
    3,897
    Rep Power
    988
    ok now try this whole code .simply paste all this code into your file.and post here what query is printed on browser
    Code:
    <!--#include File ="globalsub.asp"-->
    <%
    server.scripttimeout = 900
    'On Error Resume Next
    cmd = Request.QueryString("cmd")
    Session("autonumber") = Request.QueryString("autonumber")
    Session("autonumber") = Replace(session("autonumber"),"%2D","-")
    
    Set conntemp = server.CreateObject("adodb.Connection")
    conntemp.open "DSN=access;Database=f:\www.bellfield-barna.com\salespersonal\websales.mdb"
    
    Function CountRecs(TableName, FieldName, NoOfRecs)
    SqlStrCount = "Select Count(" + FieldName + ") As NoOfRecs From " + TableName
    Set rscount = conntemp.Execute(SqlStrCount)
    NoOfRecs = rscount("NoOfRecs")
    CountRecs = A
    rscount.Close
    End Function
    
    Select Case cmd
    
    Case "SaveNew"
    FieldStr=" ("
    ValueStr = " VALUES ("
    If Request.QueryString("prefix")<>"" Then
    FieldStr=FieldStr+ "prefix, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("prefix"))+"', "
    End if
    If Request.QueryString("firstname")<>"" Then
    FieldStr=FieldStr+ "firstname, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("firstname"))+"', "
    End if
    If Request.QueryString("lastname")<>"" Then
    FieldStr=FieldStr+ "lastname, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("lastname"))+"', "
    End if
    If Request.QueryString("additional")<>"" Then
    FieldStr=FieldStr+ "additional, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("additional"))+"', "
    End if
    If Request.QueryString("streetandnumber")<>"" Then
    FieldStr=FieldStr+ "streetandnumber, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("streetandnumber"))+"', "
    End if
    If Request.QueryString("postalcode")<>"" Then
    FieldStr=FieldStr+ "postalcode, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("postalcode"))+"', "
    End if
    If Request.QueryString("city")<>"" Then
    FieldStr=FieldStr+ "city, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("city"))+"', "
    End if
    If Request.QueryString("country")<>"" Then
    FieldStr=FieldStr+ "country, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("country"))+"', "
    End if
    If Request.QueryString("telephone")<>"" Then
    FieldStr=FieldStr+ "telephone, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("telephone"))+"', "
    End if
    If Request.QueryString("mobilephone")<>"" Then
    FieldStr=FieldStr+ "mobilephone, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("mobilephone"))+"', "
    End if
    If Request.QueryString("fax")<>"" Then
    FieldStr=FieldStr+ "fax, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("fax"))+"', "
    End if
    If Request.QueryString("email")<>"" Then
    FieldStr=FieldStr+ "email, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("email"))+"', "
    End if
    If Request.QueryString("sendbrochure")<>"" Then
    FieldStr=FieldStr+ "sendbrochure, "
    ValueStr=ValueStr+"'"+Request.QueryString("sendbrochure")+"', "
    End if
    If Request.QueryString("sendpostvisit")<>"" Then
    FieldStr=FieldStr+ "sendpostvisit, "
    ValueStr=ValueStr+"'"+Request.QueryString("sendpostvisit")+"', "
    End if
    If Request.QueryString("Informaciön")<>"" Then
    FieldStr=FieldStr+ "Informaciön, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("Informaciön"))+"', "
    End if
    FieldStr = Mid(FieldStr, 1, Len(FieldStr) - 2) + ")"
    ValueStr = Mid(ValueStr, 1, Len(ValueStr) - 2) + ")"
    SqlStr = "Insert Into contactos_1001" + FieldStr + ValueStr
    Response.write SqlStr
    Response.End 
    conntemp.Execute (SqlStr)
    conntemp.Close
    Set conntemp = Nothing
    If Err <> 0 Then
    Session("Err") = Err.Number
    Session("Description") = Err.Description
    Session("HelpContext") = Err.HelpContext
    Session("HelpFile;") = Err.HelpFile
    Session("Source") = Err.Source
    For Each Item In request.querystring
    Session(Item) = request.querystring(Item)
    Next
    response.redirect "contactos_1001form.asp?"+ Replace(request.querystring, "SaveNew", "Copy")
    End If
    response.redirect "contactos_1001form.asp?cmd=Last"
    
    Case "Save"
    SqlStr = "UPDATE contactos_1001 SET "
    If Request.QueryString("prefix") <> Session("prefix") OR IsNull(Session("prefix"))=true Then
    Sqlstr=SqlStr+"prefix='"+FixDbFieldSave(Request.QueryString("prefix")) + "', "
    End if
    If Request.QueryString("firstname") <> Session("firstname") OR IsNull(Session("firstname"))=true Then
    Sqlstr=SqlStr+"firstname='"+FixDbFieldSave(Request.QueryString("firstname")) + "', "
    End if
    If Request.QueryString("lastname") <> Session("lastname") OR IsNull(Session("lastname"))=true Then
    Sqlstr=SqlStr+"lastname='"+FixDbFieldSave(Request.QueryString("lastname")) + "', "
    End if
    If Request.QueryString("additional") <> Session("additional") OR IsNull(Session("additional"))=true Then
    Sqlstr=SqlStr+"additional='"+FixDbFieldSave(Request.QueryString("additional")) + "', "
    End if
    If Request.QueryString("streetandnumber") <> Session("streetandnumber") OR IsNull(Session("streetandnumber"))=true Then
    Sqlstr=SqlStr+"streetandnumber='"+FixDbFieldSave(Request.QueryString("streetandnumber")) + "', "
    End if
    If Request.QueryString("postalcode") <> Session("postalcode") OR IsNull(Session("postalcode"))=true Then
    Sqlstr=SqlStr+"postalcode='"+FixDbFieldSave(Request.QueryString("postalcode")) + "', "
    End if
    If Request.QueryString("city") <> Session("city") OR IsNull(Session("city"))=true Then
    Sqlstr=SqlStr+"city='"+FixDbFieldSave(Request.QueryString("city")) + "', "
    End if
    If Request.QueryString("country") <> Session("country") OR IsNull(Session("country"))=true Then
    Sqlstr=SqlStr+"country='"+FixDbFieldSave(Request.QueryString("country")) + "', "
    End if
    If Request.QueryString("telephone") <> Session("telephone") OR IsNull(Session("telephone"))=true Then
    Sqlstr=SqlStr+"telephone='"+FixDbFieldSave(Request.QueryString("telephone")) + "', "
    End if
    If Request.QueryString("mobilephone") <> Session("mobilephone") OR IsNull(Session("mobilephone"))=true Then
    Sqlstr=SqlStr+"mobilephone='"+FixDbFieldSave(Request.QueryString("mobilephone")) + "', "
    End if
    If Request.QueryString("fax") <> Session("fax") OR IsNull(Session("fax"))=true Then
    Sqlstr=SqlStr+"fax='"+FixDbFieldSave(Request.QueryString("fax")) + "', "
    End if
    If Request.QueryString("email") <> Session("email") OR IsNull(Session("email"))=true Then
    Sqlstr=SqlStr+"email='"+FixDbFieldSave(Request.QueryString("email")) + "', "
    End if
    If Request.QueryString("sendbrochure")<>"" Then
    FieldStr=FieldStr+ "sendbrochure, "
    ValueStr=ValueStr+"'"+Request.QueryString("sendbrochure")+"', "
    End if
    If Request.QueryString("sendpostvisit")<>"" Then
    FieldStr=FieldStr+ "sendpostvisit, "
    ValueStr=ValueStr+"'"+Request.QueryString("sendpostvisit")+"', "
    End if
    If Request.QueryString("Informaciön") <> Session("Informaciön") OR IsNull(Session("Informaciön"))=true Then
    Sqlstr=SqlStr+"Informaciön='"+FixDbFieldSave(Request.QueryString("Informaciön")) + "', "
    End if
    SqlStr = Mid(SqlStr, 1, Len(SqlStr) - 2)
    SqlStr = SqlStr + " WHERE autonumber="+ session("autonumber")+ " "
    If Instr(sqlstr," SE ")<=0 Then
    conntemp.Execute (SqlStr)
    End if
    SqlStr ="SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    a = 1
    While rs.EOF <> True And a < Session("CurRec")
    a = a + 1
    rs.MoveNext
    Wend
    
    Case ""
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    If rs.EOF = True Then
    Response.redirect "contactos_1001form.asp?cmd=New"
    End If
    CountRecs "contactos_1001", "autonumber", A
    Session("NumOfRecs") = a
    Session("CurRec") = 1
    
    Case "First"
    CountRecs "contactos_1001", "autonumber", A
    Session("NumOfRecs") = a
    Session("CurRec") = 1
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    
    Case "Last"
    CountRecs "contactos_1001", "autonumber", A
    Session("CurRec") = a
    Session("NumOfRecs") = a
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    a = 1
    While (a < Session("NumOfRecs")) And (rs.EOF <> True)
    a = a + 1
    rs.MoveNext
    Wend
    
    Case "Prev"
    CountRecs "contactos_1001", "autonumber", A
    Session("NumOfRecs") = a
    Session("CurRec") = Session("CurRec") - 1
    If Session("CurRec") <= 0 Then
    Session("CurRec") = Session("NumOfRecs")
    End If
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    a = 1
    While rs.EOF <> True And a < Session("CurRec")
    a = a + 1
    rs.MoveNext
    Wend
    
    Case "Next"
    CountRecs "contactos_1001", "autonumber", A
    Session("NumOfRecs") = a
    Session("CurRec") = Session("CurRec") + 1
    If Session("CurRec") > Session("NumOfRecs") Then
    Session("CurRec") = 1
    End If
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    a = 1
    While rs.EOF <> True And a < Session("CurRec")
    a = a + 1
    rs.MoveNext
    Wend
    
    Case "Del"
    SqlStr = "DELETE FROM contactos_1001 WHERE autonumber="+ Session("autonumber")
    conntemp.Execute (SqlStr)
    conntemp.Close
    Set conntemp = Nothing
    response.redirect "contactos_1001form.asp"
    
    Case "Fromlist"
    Session("CurRec") = 1
    SqlStr1 = "SELECT Count(autonumber) As TotalCount From contactos_1001"
    Set Rs1 = conntemp.Execute(SqlStr1)
    Session("NumOfRecs") = Rs1("TotalCount")
    Rs1.Close
    Set Rs1 = Nothing
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    While Trim(Session("autonumber")) <> Trim(CStr(rs("autonumber")))
    Session("CurRec") = Session("CurRec") + 1
    rs.MoveNext
    Wend
    End Select
    
    If cmd <> "New" And cmd<>"Copy" Then
    Session("autonumber") = server.Urlencode(rs("autonumber"))
    Session("prefix") = rs("prefix")
    Session("firstname") = rs("firstname")
    Session("lastname") = rs("lastname")
    Session("additional") = rs("additional")
    Session("streetandnumber") = rs("streetandnumber")
    Session("postalcode") = rs("postalcode")
    Session("city") = rs("city")
    Session("country") = rs("country")
    Session("telephone") = rs("telephone")
    Session("mobilephone") = rs("mobilephone")
    Session("fax") = rs("fax")
    Session("email") = rs("email")
    Session("sendbrochure") = rs("sendbrochure")
    Session("sendpostvisit") = rs("sendpostvisit")
    Session("Informaciön") = rs("Informaciön")
    rs.Close
    Set rs = Nothing
    End if
    
    If cmd="New" Then
    Session("autonumber") = ""
    Session("prefix") = ""
    Session("firstname") = ""
    Session("lastname") = ""
    Session("additional") = ""
    Session("streetandnumber") = ""
    Session("postalcode") = ""
    Session("city") = ""
    Session("country") = ""
    Session("telephone") = ""
    Session("mobilephone") = ""
    Session("fax") = ""
    Session("email") = ""
    Session("sendbrochure") = "False"
    Session("sendpostvisit") = "False"
    Session("Informaciön") = ""
    End If
    conntemp.Close
    Set conntemp = Nothing
    %>
    <html>
    <head><head><SCRIPT LANGUAGE="Javascript"><!--
    // ***********************************************
    
    // ***********************************************
    var isNS = (navigator.appName == "Netscape") ? 1 : 0;
    var EnableRightClick = 0;
    if(isNS) 
    document.captureEvents(Event.MOUSEDOWN||Event.MOUS  EUP);
    function mischandler(){
      if(EnableRightClick==1){ return true; }
      else {return false; }
    }
    function mousehandler(e){
      if(EnableRightClick==1){ return true; }
      var myevent = (isNS) ? e : event;
      var eventbutton = (isNS) ? myevent.which : myevent.button;
      if((eventbutton==2)||(eventbutton==3)) return false;
    }
    function keyhandler(e) {
      var myevent = (isNS) ? e : window.event;
      if (myevent.keyCode==96)
        EnableRightClick = 1;
      return;
    }
    document.oncontextmenu = mischandler;
    document.onkeypress = keyhandler;
    document.onmousedown = mousehandler;
    document.onmouseup = mousehandler;
    //-->
    </SCRIPT>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="ATAF Version 6.1.0">
    <title>Contactos_1001</title>
    <base target="_self">
    <link rel="stylesheet" type="text/css" href="globalcss.css">
    
    <script Language="JavaScript">
    function winopenexcel (sqlstr) 
    { 
    msg=open("","NewWindow","toolbar=no,location=no,directories=no,status=no,me         nubar=yes,scrollbars=yes,resizable=yes,copyhistory         =no,width=400,height=150"); 
    msg.location = "toexcel.asp?sqlstr="+sqlstr;
    msg.focus()
    }
    </script>
    
    </head>
    <body class="formpage" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" style="background-color: #DFDFDF">
    <table width="283" border="0" height="399">
    <tr>
    <td></tr>
    <td></tr>
    <td height="2"></td>
    </tr>
    <tr>
    <td></td>
    <td align="left"><img border="0" src="../../../BIE/images/c1_top.GIF" width="267" height="17"></td>
    <td height="21"></td>
    </tr>
    <tr>
    <td></td>
    <td valign="Default" >
    <form method="GET" action="contactos_1001form.asp" name="contactos_1001" onSubmit="return Checkform(this);">
    <table border="0" cellpadding="0" cellspacing="0" class="formpagetable" width="265" style="border-width: 0">
    <tr>
    <td colspan="2">
    <table width="100%" border="0">
    
    </table>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106" height="19">&nbsp;Tratamiento</td>
    <td width="164" height="19"><input class="formpagetablefield" name="prefix" size="30" Value="<%=trim(Session("prefix"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Nombre</td>
    <td width="164"><input class="formpagetablefield" name="firstname" size="30" Value="<%=trim(Session("firstname"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Apellido(s)</td>
    <td width="164"><input class="formpagetablefield" name="lastname" size="30" Value="<%=trim(Session("lastname"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Adicional</td>
    <td width="164"><input class="formpagetablefield" name="additional" size="30" Value="<%=trim(Session("additional"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Calle y Numero</td>
    <td width="164"><input class="formpagetablefield" name="streetandnumber" size="30" Value="<%=trim(Session("streetandnumber"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Codigo Postal</td>
    <td width="164"><input class="formpagetablefield" name="postalcode" size="30" Value="<%=trim(Session("postalcode"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Ciudad</td>
    <td width="164"><input class="formpagetablefield" name="city" size="30" Value="<%=trim(Session("city"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Pais</td>
    <td width="164"><input class="formpagetablefield" name="country" size="30" Value="<%=trim(Session("country"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Teléfono</td>
    <td width="164"><input class="formpagetablefield" name="telephone" size="30" Value="<%=trim(Session("telephone"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Teléfono movil</td>
    <td width="164"><input class="formpagetablefield" name="mobilephone" size="30" Value="<%=trim(Session("mobilephone"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Fax</td>
    <td width="164"><input class="formpagetablefield" name="fax" size="30" Value="<%=trim(Session("fax"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;E-mail</td>
    <td width="164"><input class="formpagetablefield" name="email" size="30" Value="<%=trim(Session("email"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Envíe folleto</td>
    <td class="formpagetablelabel" width="164">
    <%
    Response.write CreateYesNo("Si","No","Si","No","sendbrochure",Session("sendbrochure"),"No", "class='formpagetablefield'")
    %>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Carta de postvisita</td>
    <td class="formpagetablelabel" width="164">
    <%
    Response.write CreateYesNo("Si","No","Si","No","sendpostvisit",Session("sendpostvisit"),"No", "class='formpagetablefield'")
    %>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" height="25" width="106">&nbsp;Informaciön</td>
    <td height="25" width="164"><input class="formpagetablefield" name="Informaciön" size="30" Value="<%=trim(Session("Informaciön"))%>" style="float: right"></td>
    </tr>
    <tr><td align="center" colspan="3">
    <p>
    <% If cmd<>"New" And cmd<>"Copy" Then %>
    <input type="button" value="¦<" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=First&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para ir al primer registro")%> Class="formpagebutton">
    <input type="button" value="<<" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=Prev&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Mueva un registro hacia atrás")%> Class="formpagebutton">
    <input type="text" size="8" Value="<%=Session("CurRec")%> de <%=Session("NumOfRecs")%>" Class="formpagebutton">
    <input type="button" value=">>" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=Next&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para ir para registrar después")%> Class="formpagebutton">
    <input type="button" value=">¦" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=Last&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para ir al último registro")%> Class="formpagebutton">
    <p>
    
    <input type="submit" value="Ahorrar" <%=ShowTextOnPic("Chasquido aquí para salvar sus cambios")%> Class="formpagebutton">
    <input type="button" value="Borrar" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=Del&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para borrar el registro corriente")%> Class="formpagebutton">
    <input type="button" value="Nuevo" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=New&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para crear un nuevo registro")%> Class="formpagebutton" style="float: right">
    
    <input type="hidden" name="autonumber" value="<%=session("autonumber")%>">
    <input type="Hidden"name="cmd" value="Save">
    <% Else %>
    <input type="submit" value="Ahorrar" <%=ShowTextOnPic("Chasquido para salvar el nuevo registro")%> Class="formpagebutton">
    <input type="button" value="Anular" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp'" <%=ShowTextOnPic("Chasquido para anular creación de un nuevo registro")%> Class="formpagebutton">
    <input type="hidden" name="cmd" value="SaveNew">
    <%End If %>
    </td></tr>
    <tr><td align="center" colspan="3" Height="1"></td></tr>
    </table>
    
    </form>
    </td>
    
    <td height="364"></td>
    </tr>
    <tr>
    <td width="2"></td>
    <td width="267"></td>
    <td height="2" width="0"></td>
    </tr>
    </table>
    <script language="JavaScript">
    <!--
    function Checkform(thisform) {
    // Init val
    strError = 'ATAF Version 6.1.0, Database : contactos_1001\n\nYou have to correct the following error(s)\nbefore you can save your record !!.\n\n';
    intError = 0;
    if (intError == 1) {
    alert (strError)
    return false;
    }
    }
    // -->
    </script>
    <%
    If Err <> 0 Then
    pad="Sql Script Errors Occured!\n"
    pad = pad + "Error Number= #" & Err.Number & "\n"
    pad = pad + "Error Desc.= " & Err.Description &"\n\n"
    pad = pad + "Data not saved !!!\n"
    pad=Replace(pad,"'","´")
    response.write "<script language="+qu+"JavaScript"+qu+">"+CrLf
    response.write "<!--"+CrLf
    response.write "strError = '"+pad+"';"+Crlf
    response.write "alert (strError);"+CrLf
    response.write "// -->"+CrLf
    response.write "</script>"+CrLf
    End If
    
    If Session("Err") <> 0 Then
    pad="Sql Script Errors Occured!\n"
    pad=pad + "Error Number= #<b>" & Session("Err") & "\n"
    pad=pad + "Error Desc.= <b>" & Session("Description") &"\n\n"
    pad = pad + "Data not saved !!!\n"
    pad=Replace(pad,"'","´")
    response.write "<script language="+qu+"JavaScript"+qu+">"+CrLf
    response.write "<!--"+CrLf
    response.write "strError = '"+pad+"';"+Crlf
    response.write "alert (strError);"+CrLf
    response.write "// -->"+CrLf
    response.write "</script>"+CrLf
    Session("Err")=0
    End If
    %>
    
    </body>
    </html>
    .

  6. #21
    Klaus Muller is offline Contributing User
    Join Date
    Sep 2006
    Posts
    234
    Rep Power
    8
    Quote Originally Posted by Guddu
    ok now try this whole code .simply paste all this code into your file.and post here what query is printed on browser
    Code:
    <!--#include File ="globalsub.asp"-->
    <%
    server.scripttimeout = 900
    'On Error Resume Next
    cmd = Request.QueryString("cmd")
    Session("autonumber") = Request.QueryString("autonumber")
    Session("autonumber") = Replace(session("autonumber"),"%2D","-")
    
    Set conntemp = server.CreateObject("adodb.Connection")
    conntemp.open "DSN=access;Database=f:\www.bellfield-barna.com\salespersonal\websales.mdb"
    
    Function CountRecs(TableName, FieldName, NoOfRecs)
    SqlStrCount = "Select Count(" + FieldName + ") As NoOfRecs From " + TableName
    Set rscount = conntemp.Execute(SqlStrCount)
    NoOfRecs = rscount("NoOfRecs")
    CountRecs = A
    rscount.Close
    End Function
    
    Select Case cmd
    
    Case "SaveNew"
    FieldStr=" ("
    ValueStr = " VALUES ("
    If Request.QueryString("prefix")<>"" Then
    FieldStr=FieldStr+ "prefix, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("prefix"))+"', "
    End if
    If Request.QueryString("firstname")<>"" Then
    FieldStr=FieldStr+ "firstname, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("firstname"))+"', "
    End if
    If Request.QueryString("lastname")<>"" Then
    FieldStr=FieldStr+ "lastname, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("lastname"))+"', "
    End if
    If Request.QueryString("additional")<>"" Then
    FieldStr=FieldStr+ "additional, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("additional"))+"', "
    End if
    If Request.QueryString("streetandnumber")<>"" Then
    FieldStr=FieldStr+ "streetandnumber, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("streetandnumber"))+"', "
    End if
    If Request.QueryString("postalcode")<>"" Then
    FieldStr=FieldStr+ "postalcode, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("postalcode"))+"', "
    End if
    If Request.QueryString("city")<>"" Then
    FieldStr=FieldStr+ "city, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("city"))+"', "
    End if
    If Request.QueryString("country")<>"" Then
    FieldStr=FieldStr+ "country, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("country"))+"', "
    End if
    If Request.QueryString("telephone")<>"" Then
    FieldStr=FieldStr+ "telephone, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("telephone"))+"', "
    End if
    If Request.QueryString("mobilephone")<>"" Then
    FieldStr=FieldStr+ "mobilephone, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("mobilephone"))+"', "
    End if
    If Request.QueryString("fax")<>"" Then
    FieldStr=FieldStr+ "fax, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("fax"))+"', "
    End if
    If Request.QueryString("email")<>"" Then
    FieldStr=FieldStr+ "email, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("email"))+"', "
    End if
    If Request.QueryString("sendbrochure")<>"" Then
    FieldStr=FieldStr+ "sendbrochure, "
    ValueStr=ValueStr+"'"+Request.QueryString("sendbrochure")+"', "
    End if
    If Request.QueryString("sendpostvisit")<>"" Then
    FieldStr=FieldStr+ "sendpostvisit, "
    ValueStr=ValueStr+"'"+Request.QueryString("sendpostvisit")+"', "
    End if
    If Request.QueryString("Informaciön")<>"" Then
    FieldStr=FieldStr+ "Informaciön, "
    ValueStr=ValueStr+"'"+FixDbFieldSave(Request.QueryString("Informaciön"))+"', "
    End if
    FieldStr = Mid(FieldStr, 1, Len(FieldStr) - 2) + ")"
    ValueStr = Mid(ValueStr, 1, Len(ValueStr) - 2) + ")"
    SqlStr = "Insert Into contactos_1001" + FieldStr + ValueStr
    Response.write SqlStr
    Response.End 
    conntemp.Execute (SqlStr)
    conntemp.Close
    Set conntemp = Nothing
    If Err <> 0 Then
    Session("Err") = Err.Number
    Session("Description") = Err.Description
    Session("HelpContext") = Err.HelpContext
    Session("HelpFile;") = Err.HelpFile
    Session("Source") = Err.Source
    For Each Item In request.querystring
    Session(Item) = request.querystring(Item)
    Next
    response.redirect "contactos_1001form.asp?"+ Replace(request.querystring, "SaveNew", "Copy")
    End If
    response.redirect "contactos_1001form.asp?cmd=Last"
    
    Case "Save"
    SqlStr = "UPDATE contactos_1001 SET "
    If Request.QueryString("prefix") <> Session("prefix") OR IsNull(Session("prefix"))=true Then
    Sqlstr=SqlStr+"prefix='"+FixDbFieldSave(Request.QueryString("prefix")) + "', "
    End if
    If Request.QueryString("firstname") <> Session("firstname") OR IsNull(Session("firstname"))=true Then
    Sqlstr=SqlStr+"firstname='"+FixDbFieldSave(Request.QueryString("firstname")) + "', "
    End if
    If Request.QueryString("lastname") <> Session("lastname") OR IsNull(Session("lastname"))=true Then
    Sqlstr=SqlStr+"lastname='"+FixDbFieldSave(Request.QueryString("lastname")) + "', "
    End if
    If Request.QueryString("additional") <> Session("additional") OR IsNull(Session("additional"))=true Then
    Sqlstr=SqlStr+"additional='"+FixDbFieldSave(Request.QueryString("additional")) + "', "
    End if
    If Request.QueryString("streetandnumber") <> Session("streetandnumber") OR IsNull(Session("streetandnumber"))=true Then
    Sqlstr=SqlStr+"streetandnumber='"+FixDbFieldSave(Request.QueryString("streetandnumber")) + "', "
    End if
    If Request.QueryString("postalcode") <> Session("postalcode") OR IsNull(Session("postalcode"))=true Then
    Sqlstr=SqlStr+"postalcode='"+FixDbFieldSave(Request.QueryString("postalcode")) + "', "
    End if
    If Request.QueryString("city") <> Session("city") OR IsNull(Session("city"))=true Then
    Sqlstr=SqlStr+"city='"+FixDbFieldSave(Request.QueryString("city")) + "', "
    End if
    If Request.QueryString("country") <> Session("country") OR IsNull(Session("country"))=true Then
    Sqlstr=SqlStr+"country='"+FixDbFieldSave(Request.QueryString("country")) + "', "
    End if
    If Request.QueryString("telephone") <> Session("telephone") OR IsNull(Session("telephone"))=true Then
    Sqlstr=SqlStr+"telephone='"+FixDbFieldSave(Request.QueryString("telephone")) + "', "
    End if
    If Request.QueryString("mobilephone") <> Session("mobilephone") OR IsNull(Session("mobilephone"))=true Then
    Sqlstr=SqlStr+"mobilephone='"+FixDbFieldSave(Request.QueryString("mobilephone")) + "', "
    End if
    If Request.QueryString("fax") <> Session("fax") OR IsNull(Session("fax"))=true Then
    Sqlstr=SqlStr+"fax='"+FixDbFieldSave(Request.QueryString("fax")) + "', "
    End if
    If Request.QueryString("email") <> Session("email") OR IsNull(Session("email"))=true Then
    Sqlstr=SqlStr+"email='"+FixDbFieldSave(Request.QueryString("email")) + "', "
    End if
    If Request.QueryString("sendbrochure")<>"" Then
    FieldStr=FieldStr+ "sendbrochure, "
    ValueStr=ValueStr+"'"+Request.QueryString("sendbrochure")+"', "
    End if
    If Request.QueryString("sendpostvisit")<>"" Then
    FieldStr=FieldStr+ "sendpostvisit, "
    ValueStr=ValueStr+"'"+Request.QueryString("sendpostvisit")+"', "
    End if
    If Request.QueryString("Informaciön") <> Session("Informaciön") OR IsNull(Session("Informaciön"))=true Then
    Sqlstr=SqlStr+"Informaciön='"+FixDbFieldSave(Request.QueryString("Informaciön")) + "', "
    End if
    SqlStr = Mid(SqlStr, 1, Len(SqlStr) - 2)
    SqlStr = SqlStr + " WHERE autonumber="+ session("autonumber")+ " "
    If Instr(sqlstr," SE ")<=0 Then
    conntemp.Execute (SqlStr)
    End if
    SqlStr ="SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    a = 1
    While rs.EOF <> True And a < Session("CurRec")
    a = a + 1
    rs.MoveNext
    Wend
    
    Case ""
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    If rs.EOF = True Then
    Response.redirect "contactos_1001form.asp?cmd=New"
    End If
    CountRecs "contactos_1001", "autonumber", A
    Session("NumOfRecs") = a
    Session("CurRec") = 1
    
    Case "First"
    CountRecs "contactos_1001", "autonumber", A
    Session("NumOfRecs") = a
    Session("CurRec") = 1
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    
    Case "Last"
    CountRecs "contactos_1001", "autonumber", A
    Session("CurRec") = a
    Session("NumOfRecs") = a
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    a = 1
    While (a < Session("NumOfRecs")) And (rs.EOF <> True)
    a = a + 1
    rs.MoveNext
    Wend
    
    Case "Prev"
    CountRecs "contactos_1001", "autonumber", A
    Session("NumOfRecs") = a
    Session("CurRec") = Session("CurRec") - 1
    If Session("CurRec") <= 0 Then
    Session("CurRec") = Session("NumOfRecs")
    End If
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    a = 1
    While rs.EOF <> True And a < Session("CurRec")
    a = a + 1
    rs.MoveNext
    Wend
    
    Case "Next"
    CountRecs "contactos_1001", "autonumber", A
    Session("NumOfRecs") = a
    Session("CurRec") = Session("CurRec") + 1
    If Session("CurRec") > Session("NumOfRecs") Then
    Session("CurRec") = 1
    End If
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    a = 1
    While rs.EOF <> True And a < Session("CurRec")
    a = a + 1
    rs.MoveNext
    Wend
    
    Case "Del"
    SqlStr = "DELETE FROM contactos_1001 WHERE autonumber="+ Session("autonumber")
    conntemp.Execute (SqlStr)
    conntemp.Close
    Set conntemp = Nothing
    response.redirect "contactos_1001form.asp"
    
    Case "Fromlist"
    Session("CurRec") = 1
    SqlStr1 = "SELECT Count(autonumber) As TotalCount From contactos_1001"
    Set Rs1 = conntemp.Execute(SqlStr1)
    Session("NumOfRecs") = Rs1("TotalCount")
    Rs1.Close
    Set Rs1 = Nothing
    SqlStr = "SELECT * FROM contactos_1001 ORDER BY autonumber"
    Set rs = conntemp.Execute(SqlStr)
    While Trim(Session("autonumber")) <> Trim(CStr(rs("autonumber")))
    Session("CurRec") = Session("CurRec") + 1
    rs.MoveNext
    Wend
    End Select
    
    If cmd <> "New" And cmd<>"Copy" Then
    Session("autonumber") = server.Urlencode(rs("autonumber"))
    Session("prefix") = rs("prefix")
    Session("firstname") = rs("firstname")
    Session("lastname") = rs("lastname")
    Session("additional") = rs("additional")
    Session("streetandnumber") = rs("streetandnumber")
    Session("postalcode") = rs("postalcode")
    Session("city") = rs("city")
    Session("country") = rs("country")
    Session("telephone") = rs("telephone")
    Session("mobilephone") = rs("mobilephone")
    Session("fax") = rs("fax")
    Session("email") = rs("email")
    Session("sendbrochure") = rs("sendbrochure")
    Session("sendpostvisit") = rs("sendpostvisit")
    Session("Informaciön") = rs("Informaciön")
    rs.Close
    Set rs = Nothing
    End if
    
    If cmd="New" Then
    Session("autonumber") = ""
    Session("prefix") = ""
    Session("firstname") = ""
    Session("lastname") = ""
    Session("additional") = ""
    Session("streetandnumber") = ""
    Session("postalcode") = ""
    Session("city") = ""
    Session("country") = ""
    Session("telephone") = ""
    Session("mobilephone") = ""
    Session("fax") = ""
    Session("email") = ""
    Session("sendbrochure") = "False"
    Session("sendpostvisit") = "False"
    Session("Informaciön") = ""
    End If
    conntemp.Close
    Set conntemp = Nothing
    %>
    <html>
    <head><head><SCRIPT LANGUAGE="Javascript"><!--
    // ***********************************************
    
    // ***********************************************
    var isNS = (navigator.appName == "Netscape") ? 1 : 0;
    var EnableRightClick = 0;
    if(isNS) 
    document.captureEvents(Event.MOUSEDOWN||Event.MOUS  EUP);
    function mischandler(){
      if(EnableRightClick==1){ return true; }
      else {return false; }
    }
    function mousehandler(e){
      if(EnableRightClick==1){ return true; }
      var myevent = (isNS) ? e : event;
      var eventbutton = (isNS) ? myevent.which : myevent.button;
      if((eventbutton==2)||(eventbutton==3)) return false;
    }
    function keyhandler(e) {
      var myevent = (isNS) ? e : window.event;
      if (myevent.keyCode==96)
        EnableRightClick = 1;
      return;
    }
    document.oncontextmenu = mischandler;
    document.onkeypress = keyhandler;
    document.onmousedown = mousehandler;
    document.onmouseup = mousehandler;
    //-->
    </SCRIPT>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="ATAF Version 6.1.0">
    <title>Contactos_1001</title>
    <base target="_self">
    <link rel="stylesheet" type="text/css" href="globalcss.css">
    
    <script Language="JavaScript">
    function winopenexcel (sqlstr) 
    { 
    msg=open("","NewWindow","toolbar=no,location=no,directories=no,status=no,me         nubar=yes,scrollbars=yes,resizable=yes,copyhistory         =no,width=400,height=150"); 
    msg.location = "toexcel.asp?sqlstr="+sqlstr;
    msg.focus()
    }
    </script>
    
    </head>
    <body class="formpage" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" style="background-color: #DFDFDF">
    <table width="283" border="0" height="399">
    <tr>
    <td></tr>
    <td></tr>
    <td height="2"></td>
    </tr>
    <tr>
    <td></td>
    <td align="left"><img border="0" src="../../../BIE/images/c1_top.GIF" width="267" height="17"></td>
    <td height="21"></td>
    </tr>
    <tr>
    <td></td>
    <td valign="Default" >
    <form method="GET" action="contactos_1001form.asp" name="contactos_1001" onSubmit="return Checkform(this);">
    <table border="0" cellpadding="0" cellspacing="0" class="formpagetable" width="265" style="border-width: 0">
    <tr>
    <td colspan="2">
    <table width="100%" border="0">
    
    </table>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106" height="19">&nbsp;Tratamiento</td>
    <td width="164" height="19"><input class="formpagetablefield" name="prefix" size="30" Value="<%=trim(Session("prefix"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Nombre</td>
    <td width="164"><input class="formpagetablefield" name="firstname" size="30" Value="<%=trim(Session("firstname"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Apellido(s)</td>
    <td width="164"><input class="formpagetablefield" name="lastname" size="30" Value="<%=trim(Session("lastname"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Adicional</td>
    <td width="164"><input class="formpagetablefield" name="additional" size="30" Value="<%=trim(Session("additional"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Calle y Numero</td>
    <td width="164"><input class="formpagetablefield" name="streetandnumber" size="30" Value="<%=trim(Session("streetandnumber"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Codigo Postal</td>
    <td width="164"><input class="formpagetablefield" name="postalcode" size="30" Value="<%=trim(Session("postalcode"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Ciudad</td>
    <td width="164"><input class="formpagetablefield" name="city" size="30" Value="<%=trim(Session("city"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Pais</td>
    <td width="164"><input class="formpagetablefield" name="country" size="30" Value="<%=trim(Session("country"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Teléfono</td>
    <td width="164"><input class="formpagetablefield" name="telephone" size="30" Value="<%=trim(Session("telephone"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Teléfono movil</td>
    <td width="164"><input class="formpagetablefield" name="mobilephone" size="30" Value="<%=trim(Session("mobilephone"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Fax</td>
    <td width="164"><input class="formpagetablefield" name="fax" size="30" Value="<%=trim(Session("fax"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;E-mail</td>
    <td width="164"><input class="formpagetablefield" name="email" size="30" Value="<%=trim(Session("email"))%>" style="float: right"></td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Envíe folleto</td>
    <td class="formpagetablelabel" width="164">
    <%
    Response.write CreateYesNo("Si","No","Si","No","sendbrochure",Session("sendbrochure"),"No", "class='formpagetablefield'")
    %>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" width="106">&nbsp;Carta de postvisita</td>
    <td class="formpagetablelabel" width="164">
    <%
    Response.write CreateYesNo("Si","No","Si","No","sendpostvisit",Session("sendpostvisit"),"No", "class='formpagetablefield'")
    %>
    </td>
    </tr>
    <tr>
    <td align="left" valign="top" class="formpagetablelabel" height="25" width="106">&nbsp;Informaciön</td>
    <td height="25" width="164"><input class="formpagetablefield" name="Informaciön" size="30" Value="<%=trim(Session("Informaciön"))%>" style="float: right"></td>
    </tr>
    <tr><td align="center" colspan="3">
    <p>
    <% If cmd<>"New" And cmd<>"Copy" Then %>
    <input type="button" value="¦<" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=First&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para ir al primer registro")%> Class="formpagebutton">
    <input type="button" value="<<" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=Prev&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Mueva un registro hacia atrás")%> Class="formpagebutton">
    <input type="text" size="8" Value="<%=Session("CurRec")%> de <%=Session("NumOfRecs")%>" Class="formpagebutton">
    <input type="button" value=">>" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=Next&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para ir para registrar después")%> Class="formpagebutton">
    <input type="button" value=">¦" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=Last&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para ir al último registro")%> Class="formpagebutton">
    <p>
    
    <input type="submit" value="Ahorrar" <%=ShowTextOnPic("Chasquido aquí para salvar sus cambios")%> Class="formpagebutton">
    <input type="button" value="Borrar" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=Del&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para borrar el registro corriente")%> Class="formpagebutton">
    <input type="button" value="Nuevo" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp?cmd=New&autonumber=<%=Session("autonumber")%>'" <%=ShowTextOnPic("Chasquido para crear un nuevo registro")%> Class="formpagebutton" style="float: right">
    
    <input type="hidden" name="autonumber" value="<%=session("autonumber")%>">
    <input type="Hidden"name="cmd" value="Save">
    <% Else %>
    <input type="submit" value="Ahorrar" <%=ShowTextOnPic("Chasquido para salvar el nuevo registro")%> Class="formpagebutton">
    <input type="button" value="Anular" onClick="javascript:top.frames['I1'].location='contactos_1001form.asp'" <%=ShowTextOnPic("Chasquido para anular creación de un nuevo registro")%> Class="formpagebutton">
    <input type="hidden" name="cmd" value="SaveNew">
    <%End If %>
    </td></tr>
    <tr><td align="center" colspan="3" Height="1"></td></tr>
    </table>
    
    </form>
    </td>
    
    <td height="364"></td>
    </tr>
    <tr>
    <td width="2"></td>
    <td width="267"></td>
    <td height="2" width="0"></td>
    </tr>
    </table>
    <script language="JavaScript">
    <!--
    function Checkform(thisform) {
    // Init val
    strError = 'ATAF Version 6.1.0, Database : contactos_1001\n\nYou have to correct the following error(s)\nbefore you can save your record !!.\n\n';
    intError = 0;
    if (intError == 1) {
    alert (strError)
    return false;
    }
    }
    // -->
    </script>
    <%
    If Err <> 0 Then
    pad="Sql Script Errors Occured!\n"
    pad = pad + "Error Number= #" & Err.Number & "\n"
    pad = pad + "Error Desc.= " & Err.Description &"\n\n"
    pad = pad + "Data not saved !!!\n"
    pad=Replace(pad,"'","´")
    response.write "<script language="+qu+"JavaScript"+qu+">"+CrLf
    response.write "<!--"+CrLf
    response.write "strError = '"+pad+"';"+Crlf
    response.write "alert (strError);"+CrLf
    response.write "// -->"+CrLf
    response.write "</script>"+CrLf
    End If
    
    If Session("Err") <> 0 Then
    pad="Sql Script Errors Occured!\n"
    pad=pad + "Error Number= #<b>" & Session("Err") & "\n"
    pad=pad + "Error Desc.= <b>" & Session("Description") &"\n\n"
    pad = pad + "Data not saved !!!\n"
    pad=Replace(pad,"'","´")
    response.write "<script language="+qu+"JavaScript"+qu+">"+CrLf
    response.write "<!--"+CrLf
    response.write "strError = '"+pad+"';"+Crlf
    response.write "alert (strError);"+CrLf
    response.write "// -->"+CrLf
    response.write "</script>"+CrLf
    Session("Err")=0
    End If
    %>
    
    </body>
    </html>
    .

    If I fill out all field it says:
    Insert Into contactos_1001 (prefix, firstname, lastname, additional, streetandnumber, postalcode, city, country, telephone, mobilephone, fax, email, sendbrochure, sendpostvisit, Informaciön) VALUES ('ffffffffffffff', 'fffffffffffffffff', 'fffffffffffffff', 'fffffffffffff', 'ffffffffffffff', 'fffffffmmmm', 'mmm', 'mmmmmmmmmmmmmmmm', 'mmmmmmmmmmmm', 'mmmmmmmmmmmmmm', 'mmmmmmmmmmmm', 'mmmm', 'No', 'No', 'mmmmmmmmmmmmmmmm')

    If I fill out some fields:

    Insert Into contactos_1001 (prefix, firstname, lastname, additional, streetandnumber, postalcode, city, country, telephone, sendbrochure, sendpostvisit) VALUES ('gggg', 'hhhhhhhhhhh', 'hhhhhhhhhhhhhhhhh', 'hhhhhhhhhhhh', 'hhhhhhhhhhhhhhh', 'hhhhhhhhhhh', 'hhhhhhhhhhhhh', 'hhhhhhhhhhhhhhh', 'hhhhhhhhhh', 'No', 'Si')

  7. #22
    Guddu's Avatar
    Guddu is offline Contributing User
    Join Date
    Jul 2005
    Location
    Oxford UK
    Posts
    3,897
    Rep Power
    988
    ok now remove the bold line from your code.
    only remove these 2 lines from your current code and now try to add new record.
    Response.write SqlStr
    Response.End

    and now your page should work.

  8. #23
    Klaus Muller is offline Contributing User
    Join Date
    Sep 2006
    Posts
    234
    Rep Power
    8
    Quote Originally Posted by Guddu
    ok now remove the bold line from your code.
    only remove these 2 lines from your current code and now try to add new record.
    Response.write SqlStr
    Response.End

    and now your page should work.

    Great, even if I have no idea what you did. It's working - thank you very,very much. Now I will take the codes from before to compare them with the correct code you sended (just to understan a bid).
    By the way - the next problem is already laying. OK not for now (if you dont have any time) - BUT - if you have time, go once to: http://www.bellfield-barna.com/salespersonal/1001/Index.htm click on "Contactos", then "Ver lista de contactos" , choose 5, and tell me how and where I can change that layout.

    OR - if you do not have the time, JUST HAVE A GREAT DAY
    Klaus

  9. #24
    Guddu's Avatar
    Guddu is offline Contributing User
    Join Date
    Jul 2005
    Location
    Oxford UK
    Posts
    3,897
    Rep Power
    988
    create a new thread in html/javascript section.with full details what do u want .basically this is the html problem.and u should give scrolling to your frame.

    post your relevant code also....

    i will see this thread late in evening.

    cheers!!

  10. #25
    Klaus Muller is offline Contributing User
    Join Date
    Sep 2006
    Posts
    234
    Rep Power
    8
    Quote Originally Posted by Guddu
    create a new thread in html/javascript section.with full details what do u want .basically this is the html problem.and u should give scrolling to your frame.

    post your relevant code also....

    i will see this thread late in evening.

    cheers!!
    thanks, I just send a mail to you at yahoo.

Page 2 of 2 FirstFirst 12
Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. US Date Format in IIS
    By buzyonok in forum ASP Development
    Replies: 4
    Last Post: January 10th, 2006, 01:45 AM
  2. Detecting Client Mail Format and Depending on it, either Hide of Display appropriate
    By SimplySatishD in forum HTML, JavaScript And CSS Help
    Replies: 1
    Last Post: July 20th, 2005, 03:20 AM
  3. Replies: 1
    Last Post: August 30th, 2004, 11:08 AM
  4. Displaying Dates in DD/MM/YYYY format
    By msaunders in forum Microsoft Access Help
    Replies: 3
    Last Post: May 27th, 2004, 07:08 AM
  5. Date format problems in Access2000, need your help!
    By mauron in forum Microsoft Access Help
    Replies: 1
    Last Post: December 9th, 2003, 01:34 PM

ASP Free Advertisers and Affiliates