SQL Update not Updating 
Author Message
 SQL Update not Updating

I know this is a lot of code, so Im sorry about that.

I have a site where I am able to place orders, view records, change
password using SQL Update, but this page that allows a record to be
modified isn't updating the table.

No matter what I change, the table values stay the same but it says it
posted correctly... so Im not getting an error.

Thanks a bunch!

john

<html>
<!-- #include file="orderlib.asp" -->

<%

'my new variables

Call OpenDBConn
Call InsertContents  

Sub InsertContents

LabName                 = Request.Form("LabName")
Password                = Request.Form("Password")

sLabName                = Request.Form("LabName")  'is also username!!!
sPassword       = Request.Form("Password")
iID                             = FVal(Request.Form("ID"))
sOrderPlacedBy  = Request.Form("OrderPlacedBy")
sRoomNum                = Request.Form("RoomNum")
sTodaysDate             = Request.Form("TodaysDate") 'date is being used by me as
a string may cause error
sGrantAcctNum   = Request.Form("GrantAcctNum")
iQty1                   = FVal(Request.Form("Qty1"))
iQty2                   = FVal(Request.Form("Qty2"))
iQty3                   = FVal(Request.Form("Qty3"))
iQty4                   = FVal(Request.Form("Qty4"))
iQty5                   = FVal(Request.Form("Qty5"))
sCat1                   = Request.Form("Cat1")
sCatalogueNum2  = Request.Form("CatalogueNum2")
sCatalogueNum3  = Request.Form("CatalogueNum3")
sCatalogueNum4  = Request.Form("CatalogueNum4")
sCatalogueNum5  = Request.Form("CatalogueNum5")
sDescription1   = Request.Form("Description1")
sDescription2   = Request.Form("Description2")
sDescription3   = Request.Form("Description3")
sDescription4   = Request.Form("Description4")
sDescription5   = Request.Form("Description5")
iCost1                  = Request.Form("Cost1")
iUnitCost2              = Request.Form("UnitCost2")
iUnitCost3              = Request.Form("UnitCost3")
iUnitCost4              = Request.Form("UnitCost4")
iUnitCost5              = Request.Form("UnitCost5")
iTotal1                 = FVal(Request.Form("Total1"))
iTotalCost2             = FVal(Request.Form("TotalCost2"))
iTotalCost3             = FVal(Request.Form("TotalCost3"))
iTotalCost4             = FVal(Request.Form("TotalCost4"))
iTotalCost5             = FVal(Request.Form("TotalCost5"))
iTotalCost              = FVal(Request.Form("TotalCost"))
sComments               = Request.Form("Comments")
sVendorName             = Request.Form("VendorName")
sVendorPhone    = Request.Form("VendorPhone")
sOtherVendor    = Request.Form("OtherVendor")
sOtherVPhone    = Request.Form("OtherVPhone")
sOvernight              = Request.Form("Overnight")
sRadioactive    = Request.Form("Radioactive")
sEmail                  = Request.Form("Email")

        userSQL = ""
        userSQL = userSQL & "SELECT * FROM registration WHERE "
        userSQL = userSQL & "username = " & SQLStr(sUserName) & " AND
password = " & SQLStr(sPassword)
        Set UserRS = GobjConnect.Execute(userSQL)      

                        cSQL = ""
                                cSQL = cSQL & "UPDATE Purchasing "
                                cSQL = cSQL & "SET LabName = " & SQLStr(sLabName) & ",
OrderPlacedBy = " & SQLStr(sOrderPlacedBy) & "  "
                                cSQL = cSQL & ",GrantAcctNum = " & SQLStr(sGrantAcctNum) & ",
RoomNum = " & SQLStr(sRoomNum) & "  "
                                cSQL = cSQL & ",TodaysDate = " & SQLStr(sTodaysDate) & ", Qty1 = "
& SQLVal(iQty1) &"  "
                                cSQL = cSQL & ",Cat1 = " & SQLVal(iCat1) & ", Description1 = " &
SQLStr(sDescription1) & "  "
                                cSQL = cSQL & ",Cost1 = " & SQLVal(iCost1) & ", Total1 = " &
SQLVal(iTotal1) & "  "
                                cSQL = cSQL & ",Qty2 = " & SQLVal(iQty2) & ", CatalogueNum2 = " &
SQLVal(iCatalogueNum2) & "  "
                                cSQL = cSQL & ",Description2 = " & SQLStr(sDescription2) & ",
UnitCost2 = " & SQLVal(iUnitCost2) & "  "
                                cSQL = cSQL & ",TotalCost2 = " & SQLVal(iTotalCost2) & ""
                                cSQL = cSQL & ",Qty3 = " & SQLVal(iQty3) & ", CatalogueNum3 = " &
SQLStr(sCatalogueNum3) & "  "
                                cSQL = cSQL & ",Description3 = " & SQLStr(sDescription3) & ",
UnitCost3 = " & SQLVal(iUnitCost3) & "  "
                                cSQL = cSQL & ",TotalCost3 = " & SQLVal(iTotalCost3) & ""
                                cSQL = cSQL & ",Qty4 = " & SQLVal(iQty4) & ", CatalogueNum4 = " &
SQLStr(sCatalogueNum4) & "  "
                                cSQL = cSQL & ",Description4 = " & SQLStr(sDescription4) & ",
UnitCost4 = " & SQLVal(iUnitCost4) & "  "
                                cSQL = cSQL & ",TotalCost4 = " & SQLVal(iTotalCost4) & ""
                                cSQL = cSQL & ",Qty5 = " & SQLVal(iQty5) & ", CatalogueNum5 = " &
SQLStr(sCatalogueNum5) & "  "
                                cSQL = cSQL & ",Description5 = " & SQLStr(sDescription5) & ",
UnitCost5 = " & SQLVal(iUnitCost5) & "  "
                                cSQL = cSQL & ",TotalCost5 = " & SQLVal(iTotalCost5) & ""
                                cSQL = cSQL & " WHERE ID = " & SQLVal(iID) & ""

                        GobjConnect.Execute(cSQL)

%>  
<head>
</head>
<body bgcolor="#000080" text="#000000" leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0" link="#000000" vlink="#666666"
alink="#FF0000">

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left" valign="top" bgcolor="#000080" width="268">
    <font size="6" color="#FFFFFF">Web Purchasing</font></td>
    <td align="right" valign="top" bgcolor="#000080">
    &nbsp;</td>
  </tr>
  <tr>
    <td align="left" valign="top" colspan="2">
    <img src="../../../classified/assets/horizontalBar.gif"
width="100%" height="1"></td>
  </tr>
  <tr>
    <td align="left" valign="top" bgcolor="#FFFFFF" colspan="2">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr align="left" valign="middle">
          <td bgcolor="#C0C0C0">
            <div class = "toolbar"><b><font face="Verdana, Arial,
Helvetica, sans-serif"><font color="#FFFFFF" size="1"><a
href=" http://www.*-*-*.com/ ;>&nbsp; </a>
              <a href=" http://www.*-*-*.com/ ">BIOCHEM
              HOME</a></font><font size="1">
              |</font><font color="#FFFFFF" size="1"><a
href="placeAnAd.asp"> </a></font>
              <font size="1">
              <a href="viewhistory.asp?LabName=<%Response.Write(LabName)%>&Password=<%Response.Write(Password)%>">ORDER
HISTORY</a>
              |
              <a href="placeanorder.asp?LabName=<%Response.Write(LabName)%>&Password=<%Response.Write(Password)%>">PLACE
ORDER</a> |  </font></font>
              <font face="Verdana, Arial, Helvetica, sans-serif"
size="1">
              <a href="othertools.asp?LabName=<%Response.Write(LabName)%>&Password=<%Response.Write(Password)%>">OTHER
TOOLS</a></font></b></div>
          </td>
                 </tr>
      </table>    
                <CENTER>
        <h3>Your Order has been posted successfully!<bR><br>
        </h3>
        <FORM METHOD="GET" ACTION="masthistory.asp"
name="FrontPage_Formx">
                                <p align="center">
        <input type="submit" name="submit" value="View Past Orders">
</p>
                <p align="center">
                &nbsp;</p>
                </form>

                </CENTER>
<%
        UserRS.Close
        Set UserRS = Nothing

End Sub

%>
<%

Call CloseDBConn

%>

</body>
</html>



Wed, 01 Dec 2004 01:10:53 GMT  
 SQL Update not Updating
Why X-post?

Messy code btw.



Wed, 01 Dec 2004 02:44:54 GMT  
 SQL Update not Updating



Quote:
> I know this is a lot of code, so Im sorry about that.

> I have a site where I am able to place orders, view records, change
> password using SQL Update, but this page that allows a record to be
> modified isn't updating the table.

> No matter what I change, the table values stay the same but it says it
> posted correctly... so Im not getting an error.

<snipped code>

Quote:
>it says it posted correctly

who's "it" ? :)

write
Response.Write(cSQL)
above the GobjConnect.Execute(cSQL)

now you will see the generated SQL statement in your browser. copy the
statement into query analyzer and see if it does anything. Narrow the
problem down. my guess is that iID is empty or the ID doesn't exist for some
reason.



Wed, 01 Dec 2004 04:54:23 GMT  
 SQL Update not Updating


Quote:
>I know this is a lot of code, so Im sorry about that.

>I have a site where I am able to place orders, view records, change
>password using SQL Update, but this page that allows a record to be
>modified isn't updating the table.

>No matter what I change, the table values stay the same but it says it
>posted correctly... so Im not getting an error.

>Thanks a bunch!

>john

Don't you need  UserRS.Update to action the changes to the recordset ?

John Wood



Sat, 04 Dec 2004 02:04:30 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. CAB files not updating on client side when VBscript is updated

2. Dataset changes updates grid , How to update SQL table

3. Help: updating text file-Updating Data in a linked table not supported by this ISAM

4. ADODB.Recordset.Update does not update?

5. 2nd SQL Server update after update text field corrupts row - using RDO

6. Updating data to a memo field using SQL UPDATE

7. Access updated crystal not update!?

8. Access updated crystal not update!?

9. Bound controls not updating ADO with adodc.recordset.update command

10. UPDATE query not updating records

11. Updating textbox via code not updating recordset

12. oledb: foxpro index file not updating after inserts and updates

 

 
Powered by phpBB® Forum Software