Professional Web Applications Themes

HElp urgent ! connection conflict in the UPdate function - ASP Database

<html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Doent"> <meta http-equiv="Content-Type" content="text/html; cht=windows-1252"> <title>Shipment Description</title> <script language="javascript"> function PopUp(ref) { var strFeatures="toolbar=no,status=no,menubar=no,locat ion=no" strFeatures=strFeatures+",scrollbars=no,resizable= yes,height=320,width=620" newWin = window.open(ref,"TellObj",strFeatures); newWin.opener = Left; } </script> </head> <style> .label { font-family:arial; font-size:8pt; font-color:blue }+ </style> </SCRIPT><FORM Name=frmMain METHOD='POST' ACTION='imcdbStartTable.asp'> <body> <% Function GetAllData(cnn) Dim rs Dim SQL Dim str Dim rowNum Dim Count SQL="Select distinct a.CustomerReference," SQL= SQL & "a.Description2,isnull(a.PONum,'NULL') As PONum,a.QtyShipped,a.ShipMethod," SQL= SQL & "a.ShipDate,isnull(a.HAWB,'NULL') As HAWB,isnull(a.MAWB,'NULL') As MAWB," SQL= SQL & "b.ETDDate,b.ETAFCZ,b.FlightDetails," SQL= SQL & "(a.QtyShipped-sum(c.ReceivedQty))As BalanceQty " SQL= SQL & "From tblimcdb_v a inner join tblUserDefine2 ...

  1. #1

    Default HElp urgent ! connection conflict in the UPdate function

    <html>

    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Doent">
    <meta http-equiv="Content-Type" content="text/html; cht=windows-1252">
    <title>Shipment Description</title>
    <script language="javascript">
    function PopUp(ref)
    {
    var strFeatures="toolbar=no,status=no,menubar=no,locat ion=no"
    strFeatures=strFeatures+",scrollbars=no,resizable= yes,height=320,width=620"

    newWin = window.open(ref,"TellObj",strFeatures);
    newWin.opener = Left;
    }

    </script>
    </head>
    <style>
    .label { font-family:arial; font-size:8pt; font-color:blue }+
    </style>
    </SCRIPT><FORM Name=frmMain METHOD='POST' ACTION='imcdbStartTable.asp'>
    <body>


    <%

    Function GetAllData(cnn)
    Dim rs
    Dim SQL
    Dim str
    Dim rowNum
    Dim Count

    SQL="Select distinct a.CustomerReference,"
    SQL= SQL & "a.Description2,isnull(a.PONum,'NULL') As
    PONum,a.QtyShipped,a.ShipMethod,"
    SQL= SQL & "a.ShipDate,isnull(a.HAWB,'NULL') As HAWB,isnull(a.MAWB,'NULL')
    As MAWB,"
    SQL= SQL & "b.ETDDate,b.ETAFCZ,b.FlightDetails,"
    SQL= SQL & "(a.QtyShipped-sum(c.ReceivedQty))As BalanceQty "
    SQL= SQL & "From tblimcdb_v a inner join tblUserDefine2 b on
    a.CustomerReference=b.CustomerReference "
    SQL= SQL & "inner join tblSubimcdb c on
    b.CustomerReference=c.CustomerReference "
    SQL= SQL & "group by
    a.CustomerReference,a.Description2,a.PONum,a.ShipM ethod,a.HAWB,a.MAWB,"
    SQL= SQL &
    "b.ETDDate,b.ETAFCZ,b.FlightDetails,a.ShipDate,a.Q tyShipped,BalanceQty"
    SQL= SQL & " having (QtyShipped-sum(c.ReceivedQty))>0"


    Set rs=CreateObject("ADODB.Recordset")

    rs.ActiveConnection=cnn

    rs.Open SQL

    rowNum=0

    While Not rs.EOF

    str= str & "<TR bgcolor='#BBFAFF' >"
    str= str & "<TD><span class='label'>"
    str= str & rowNum & "</span></TD>"
    str= str & "<TD><span class='label'>"
    str= str & rs("Description2") & "</span></TD>"
    str= str & "<TD><span class='label'>"
    str= str & rs("PONum") & "</span></TD>"
    str= str & "<TD><span class='label'>"
    str= str & "<INPUT Name='txtCustomerReference" & rowNum & "' value= '" &
    rs("CustomerReference")& "' font size='8' ></span></TD>"
    str= str & "<TD><span class='label'>"
    str= str & rs("QtyShipped") & "</span></TD>"
    str= str & "<TD><span class='label'>"
    str= str & rs("ShipMethod") & "</span></TD>"
    str= str & "<TD><span class='label'>"
    str= str & rs("ShipDate") & "</span></TD>"
    str= str & "<TD><span class='label'>"
    str= str & "<INPUT Name='txtETDDate" & rowNum & "' Height='30' value= '" &
    rs("ETDDate")& "' font size='8' ></span></TD>"
    str= str & "<TD><span class='label'>"
    str= str & rs("HAWB") & "</span></TD>"
    str= str & "<TD><span class='label'>"
    str= str & rs("MAWB") & "</span></TD>"
    str= str & "<TD><span class='label'>"
    str= str & "<INPUT Name='txtETAFCZ" & rowNum & "' Height='30' value= '" &
    rs("ETAFCZ")& "' font size='8'></span></TD>"
    str= str & "<TD><span class='label'>"
    str= str & "<TEXTAREA Name='txtFD" & rowNum & "' rows='2' cols='15'
    Height='10' font size='8' > " & rs("FlightDetails")&
    "</TEXTAREA></span></TD>"
    str= str & "<TD><span class='label'>"
    str= str & rs("BalanceQty") & "</span></TD>"
    str= str & "<TD><span class='label'>"
    'str= str & "<p><a target='_blank' href='StratSubForm.asp'><img
    src='Arrow.gif'></span></TD></a></p>"
    'str= str & "<p><a href='JavaScript:PopUp('StratSubForm.asp')'><img
    src='Arrow.gif'></span></TD></a></p>"
    str = str & "<p><a href=" & CHR(034) &
    "JavaScript:PopUp('StratSubForm.asp')" & CHR(034) & "><img
    src='Arrow.gif'></span></ TD></a></p>"
    str= str & "</TR>"

    rowNum=rowNum+1
    rs.moveNext
    Wend
    GetAllData=str
    End Function



    Function Update(cnn,CustomerReference2,ETDDate2,ETAFCZ2,Fli ghtDetails2)
    Dim SQL
    Dim cmd
    Dim i


    SQL=SQL & "If '" & CustomerReference2 & "'=(select CustomerReference from
    tblUserDefine2 where CustomerReference= '" & CustomerReference2 & "' Group
    by CustomerReference) begin "
    SQl=SQL & "update tblUserDefine2 "
    SQL= SQL & "set ETDDate='" & ETDDate2 & "', ETAFCZ='" & ETAFCZ2 &
    "',FlightDetails='" & FlightDetails2 & "' "
    SQL= SQL & " where CustomerReference= '" & CustomerReference2 & "' "
    SQL= SQL & " end "
    SQL= SQL & "else begin "
    SQL= SQL & "INSERT INTO tblUserDefine2 "
    SQL= SQL &
    "(tblUserDefine2.CustomerReference,tblUserDefine2. ETDDate,tblUserDefine2.ETA
    FCZ,FlightDetails)"
    SQL= SQL & " VALUES ('"
    SQL= SQL & CustomerReference2 & "', '"
    SQL= SQL & ETDDate2 & "', '"
    SQL= SQL & ETAFCZ2 & "', '"
    SQL= SQL & FlightDetails2 & "')"
    SQL= SQL & "end"

    Set cmd=CreateObject("ADODB.Command")

    cmd.CommandText= SQL
    cmd.ActiveConnection=cnn
    cmd.Execute


    Set cmd.ActiveConnection=Nothing
    Set cmd = Nothing


    Update=True
    Exit Function
    On Error Resume Next
    Update=False
    End Function

    Dim i
    Dim ETDDate2
    Dim ETAFCZ2
    Dim FlightDetails2
    Dim CustomerReference2
    Dim Count
    Dim str
    Dim cnn



    Count=Request.form.count
    'i=0
    For i=0 to Count
    CustomerReference2=Request.Form( "txtCustomerReference" & i )
    ETDDate2=Request.Form("txtETDDate" & i )
    ETAFCZ2=Request.Form("txtETAFCZ" & i)
    FlightDetails2=Request.Form("txtFD" & i )
    Call Update(cnn,CustomerReference2,ETDDate2,ETAFCZ2,Fli ghtDetails2)
    Next



    Set cnn=CreateObject("ADODB.Connection")
    str="Data Source=imcdb;"
    str= str & "User ID=imcdb_admin;Password=imcdb;"



    cnn.Open str
    If Update(cnn,CustomerReference2,ETDDate2,ETAFCZ2,Fli ghtDetails2) Then

    Response.write"<TABLE Border=3 Width='1100' Height='4' bordercolor=blue
    bgcolor='#BBFAFF'>"
    Response.write"<col Height='0.5%' col width='2%' col width='5%' col
    width='5%' col width='10%' col width='10%' col width='3%' col width='10%'col
    width='5%'col width='2%' col width='2%' col width='5%' col width='2%' col
    width='5%' col width='5%'>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"NO.</span></TH>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"Cisco model</span></TH>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"Cisco PO#</span></TH>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"Packing Slip</span></TH>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"Ship Qty</span></TH>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"Ship Method(S/A)</span></TH>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"Ex Factory Date</span></TH>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"ETD Date</span></TH>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"HAWB</span></TH>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"MAWB</span></TH>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"ETA FCZ</span></TH>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"Flight Details</span></TH>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"Balance to Receive</span></TH>"
    Response.write"<TH>"
    Response.write"<span class='label'>"
    Response.write"Link</span></TH>"
    Response.write GetAllData(cnn)
    Response.write "</TABLE>"
    Response.write"</FONT>"
    Else
    Response.write "<FONT COLOR=Red Size=5 FACE=ARIAL>"
    Response.write "update failed! "
    Response.write "</FONT>"
    End if
    'i=i+1

    cnn.Close


    %>


    <INPUT Name='Submit' Type='submit' Value=' Update ' ></FORM>


    </body>

    </html>



    chan Guest

  2. #2

    Default Re: HElp urgent ! connection conflict in the UPdate function

    error message? explanation of problem? short example with same problem?

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    [url]www.ielearning.com[/url]


    "chan" <ccl555hotmail.com> wrote in message
    news:el4GimnaEHA.2792TK2MSFTNGP09.phx.gbl...
    > <html>
    >
    > <head>
    > <meta http-equiv="Content-Language" content="en-us">
    > <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    > <meta name="ProgId" content="FrontPage.Editor.Doent">
    > <meta http-equiv="Content-Type" content="text/html; cht=windows-1252">
    > <title>Shipment Description</title>
    > <script language="javascript">
    > function PopUp(ref)
    > {
    > var strFeatures="toolbar=no,status=no,menubar=no,locat ion=no"
    >
    strFeatures=strFeatures+",scrollbars=no,resizable= yes,height=320,width=620"
    >
    > newWin = window.open(ref,"TellObj",strFeatures);
    > newWin.opener = Left;
    > }
    >
    > </script>
    > </head>
    > <style>
    > .label { font-family:arial; font-size:8pt; font-color:blue }+
    > </style>
    > </SCRIPT><FORM Name=frmMain METHOD='POST' ACTION='imcdbStartTable.asp'>
    > <body>
    >
    >
    > <%
    >
    > Function GetAllData(cnn)
    > Dim rs
    > Dim SQL
    > Dim str
    > Dim rowNum
    > Dim Count
    >
    > SQL="Select distinct a.CustomerReference,"
    > SQL= SQL & "a.Description2,isnull(a.PONum,'NULL') As
    > PONum,a.QtyShipped,a.ShipMethod,"
    > SQL= SQL & "a.ShipDate,isnull(a.HAWB,'NULL') As HAWB,isnull(a.MAWB,'NULL')
    > As MAWB,"
    > SQL= SQL & "b.ETDDate,b.ETAFCZ,b.FlightDetails,"
    > SQL= SQL & "(a.QtyShipped-sum(c.ReceivedQty))As BalanceQty "
    > SQL= SQL & "From tblimcdb_v a inner join tblUserDefine2 b on
    > a.CustomerReference=b.CustomerReference "
    > SQL= SQL & "inner join tblSubimcdb c on
    > b.CustomerReference=c.CustomerReference "
    > SQL= SQL & "group by
    > a.CustomerReference,a.Description2,a.PONum,a.ShipM ethod,a.HAWB,a.MAWB,"
    > SQL= SQL &
    > "b.ETDDate,b.ETAFCZ,b.FlightDetails,a.ShipDate,a.Q tyShipped,BalanceQty"
    > SQL= SQL & " having (QtyShipped-sum(c.ReceivedQty))>0"
    >
    >
    > Set rs=CreateObject("ADODB.Recordset")
    >
    > rs.ActiveConnection=cnn
    >
    > rs.Open SQL
    >
    > rowNum=0
    >
    > While Not rs.EOF
    >
    > str= str & "<TR bgcolor='#BBFAFF' >"
    > str= str & "<TD><span class='label'>"
    > str= str & rowNum & "</span></TD>"
    > str= str & "<TD><span class='label'>"
    > str= str & rs("Description2") & "</span></TD>"
    > str= str & "<TD><span class='label'>"
    > str= str & rs("PONum") & "</span></TD>"
    > str= str & "<TD><span class='label'>"
    > str= str & "<INPUT Name='txtCustomerReference" & rowNum & "' value= '" &
    > rs("CustomerReference")& "' font size='8' ></span></TD>"
    > str= str & "<TD><span class='label'>"
    > str= str & rs("QtyShipped") & "</span></TD>"
    > str= str & "<TD><span class='label'>"
    > str= str & rs("ShipMethod") & "</span></TD>"
    > str= str & "<TD><span class='label'>"
    > str= str & rs("ShipDate") & "</span></TD>"
    > str= str & "<TD><span class='label'>"
    > str= str & "<INPUT Name='txtETDDate" & rowNum & "' Height='30' value= '"
    &
    > rs("ETDDate")& "' font size='8' ></span></TD>"
    > str= str & "<TD><span class='label'>"
    > str= str & rs("HAWB") & "</span></TD>"
    > str= str & "<TD><span class='label'>"
    > str= str & rs("MAWB") & "</span></TD>"
    > str= str & "<TD><span class='label'>"
    > str= str & "<INPUT Name='txtETAFCZ" & rowNum & "' Height='30' value= '" &
    > rs("ETAFCZ")& "' font size='8'></span></TD>"
    > str= str & "<TD><span class='label'>"
    > str= str & "<TEXTAREA Name='txtFD" & rowNum & "' rows='2' cols='15'
    > Height='10' font size='8' > " & rs("FlightDetails")&
    > "</TEXTAREA></span></TD>"
    > str= str & "<TD><span class='label'>"
    > str= str & rs("BalanceQty") & "</span></TD>"
    > str= str & "<TD><span class='label'>"
    > 'str= str & "<p><a target='_blank' href='StratSubForm.asp'><img
    > src='Arrow.gif'></span></TD></a></p>"
    > 'str= str & "<p><a href='JavaScript:PopUp('StratSubForm.asp')'><img
    > src='Arrow.gif'></span></TD></a></p>"
    > str = str & "<p><a href=" & CHR(034) &
    > "JavaScript:PopUp('StratSubForm.asp')" & CHR(034) & "><img
    > src='Arrow.gif'></span></ TD></a></p>"
    > str= str & "</TR>"
    >
    > rowNum=rowNum+1
    > rs.moveNext
    > Wend
    > GetAllData=str
    > End Function
    >
    >
    >
    > Function Update(cnn,CustomerReference2,ETDDate2,ETAFCZ2,Fli ghtDetails2)
    > Dim SQL
    > Dim cmd
    > Dim i
    >
    >
    > SQL=SQL & "If '" & CustomerReference2 & "'=(select CustomerReference
    from
    > tblUserDefine2 where CustomerReference= '" & CustomerReference2 & "' Group
    > by CustomerReference) begin "
    > SQl=SQL & "update tblUserDefine2 "
    > SQL= SQL & "set ETDDate='" & ETDDate2 & "', ETAFCZ='" & ETAFCZ2 &
    > "',FlightDetails='" & FlightDetails2 & "' "
    > SQL= SQL & " where CustomerReference= '" & CustomerReference2 & "' "
    > SQL= SQL & " end "
    > SQL= SQL & "else begin "
    > SQL= SQL & "INSERT INTO tblUserDefine2 "
    > SQL= SQL &
    >
    "(tblUserDefine2.CustomerReference,tblUserDefine2. ETDDate,tblUserDefine2.ETA
    > FCZ,FlightDetails)"
    > SQL= SQL & " VALUES ('"
    > SQL= SQL & CustomerReference2 & "', '"
    > SQL= SQL & ETDDate2 & "', '"
    > SQL= SQL & ETAFCZ2 & "', '"
    > SQL= SQL & FlightDetails2 & "')"
    > SQL= SQL & "end"
    >
    > Set cmd=CreateObject("ADODB.Command")
    >
    > cmd.CommandText= SQL
    > cmd.ActiveConnection=cnn
    > cmd.Execute
    >
    >
    > Set cmd.ActiveConnection=Nothing
    > Set cmd = Nothing
    >
    >
    > Update=True
    > Exit Function
    > On Error Resume Next
    > Update=False
    > End Function
    >
    > Dim i
    > Dim ETDDate2
    > Dim ETAFCZ2
    > Dim FlightDetails2
    > Dim CustomerReference2
    > Dim Count
    > Dim str
    > Dim cnn
    >
    >
    >
    > Count=Request.form.count
    > 'i=0
    > For i=0 to Count
    > CustomerReference2=Request.Form( "txtCustomerReference" & i )
    > ETDDate2=Request.Form("txtETDDate" & i )
    > ETAFCZ2=Request.Form("txtETAFCZ" & i)
    > FlightDetails2=Request.Form("txtFD" & i )
    > Call Update(cnn,CustomerReference2,ETDDate2,ETAFCZ2,Fli ghtDetails2)
    > Next
    >
    >
    >
    > Set cnn=CreateObject("ADODB.Connection")
    > str="Data Source=imcdb;"
    > str= str & "User ID=imcdb_admin;Password=imcdb;"
    >
    >
    >
    > cnn.Open str
    > If Update(cnn,CustomerReference2,ETDDate2,ETAFCZ2,Fli ghtDetails2) Then
    >
    > Response.write"<TABLE Border=3 Width='1100' Height='4' bordercolor=blue
    > bgcolor='#BBFAFF'>"
    > Response.write"<col Height='0.5%' col width='2%' col width='5%' col
    > width='5%' col width='10%' col width='10%' col width='3%' col
    width='10%'col
    > width='5%'col width='2%' col width='2%' col width='5%' col width='2%' col
    > width='5%' col width='5%'>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"NO.</span></TH>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"Cisco model</span></TH>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"Cisco PO#</span></TH>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"Packing Slip</span></TH>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"Ship Qty</span></TH>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"Ship Method(S/A)</span></TH>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"Ex Factory Date</span></TH>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"ETD Date</span></TH>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"HAWB</span></TH>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"MAWB</span></TH>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"ETA FCZ</span></TH>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"Flight Details</span></TH>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"Balance to Receive</span></TH>"
    > Response.write"<TH>"
    > Response.write"<span class='label'>"
    > Response.write"Link</span></TH>"
    > Response.write GetAllData(cnn)
    > Response.write "</TABLE>"
    > Response.write"</FONT>"
    > Else
    > Response.write "<FONT COLOR=Red Size=5 FACE=ARIAL>"
    > Response.write "update failed! "
    > Response.write "</FONT>"
    > End if
    > 'i=i+1
    >
    > cnn.Close
    >
    >
    > %>
    >
    >
    > <INPUT Name='Submit' Type='submit' Value=' Update ' ></FORM>
    >
    >
    > </body>
    >
    > </html>
    >
    >
    >

    Mark Schupp Guest

Similar Threads

  1. Replies: 2
    Last Post: March 4th, 06:24 PM
  2. OLE DB Connection HELP ME - URGENT
    By R.C.Silva in forum Dreamweaver AppDev
    Replies: 0
    Last Post: February 27th, 09:29 PM
  3. Update statistics suggestions --Urgent
    By KalpanaPai in forum Informix
    Replies: 2
    Last Post: August 20th, 06:16 PM
  4. URGENT: Automate an update
    By Kalle in forum Oracle Server
    Replies: 2
    Last Post: July 2nd, 10:19 AM
  5. Suse 8.0 Update / XFree86 Conflict?
    By Renegade in forum Linux Setup, Configuration & Administration
    Replies: 1
    Last Post: June 28th, 12:47 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139