Updating the database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Debra Ehrlich

    Updating the database

    I'm having a difficult time calling UPDATE when my 'WHERE" clause calls ID,
    which is numeric and the primary key. I found that I can do a SELECT just
    fine with "WHERE ID".. Is there something special about UPDATE that i'm not
    getting? I've searched the internet but it appears that what I'm doing
    should work.

    Any help would be greatly appreciated.


    if (modcustomer == "relate")
    {
    var modid1 = Request.Form ("modid1");
    var modid2 = Request.Form ("modid2");
    var relationship = Request.Form ("relationship" );
    var comments = Request.Form("c omments");

    SqlString = "UPDATE Customer SET Relationship = ' " + relationship + " '
    WHERE ID = " + modid1;
    connection.Exec ute (SqlString);

    }

    thanks,

    Debbie Ehrlich
    Reliable Software - Developers of Code Co-op®, Server-less version control
    for distributed teams www.relisoft.com


  • Debra Ehrlich

    #2
    Re: Updating the database

    please disregard.
    I solved my problem. My table field had a typo.


    "Debra Ehrlich" <debbie@relisof t.com> wrote in message
    news:bfpoh9$tuu $1@brokaw.wa.co m...[color=blue]
    > I'm having a difficult time calling UPDATE when my 'WHERE" clause calls[/color]
    ID,[color=blue]
    > which is numeric and the primary key. I found that I can do a SELECT just
    > fine with "WHERE ID".. Is there something special about UPDATE that i'm[/color]
    not[color=blue]
    > getting? I've searched the internet but it appears that what I'm doing
    > should work.
    >
    > Any help would be greatly appreciated.
    >
    >
    > if (modcustomer == "relate")
    > {
    > var modid1 = Request.Form ("modid1");
    > var modid2 = Request.Form ("modid2");
    > var relationship = Request.Form ("relationship" );
    > var comments = Request.Form("c omments");
    >
    > SqlString = "UPDATE Customer SET Relationship = ' " + relationship + " '
    > WHERE ID = " + modid1;
    > connection.Exec ute (SqlString);
    >
    > }
    >
    > thanks,
    >
    > Debbie Ehrlich
    > Reliable Software - Developers of Code Co-op®, Server-less version[/color]
    control[color=blue]
    > for distributed teams www.relisoft.com
    >
    >[/color]


    Comment

    • Rowan

      #3
      Re: Updating the database

      I had this problem yesterday. I found that when I was updating using
      an ID I had to take out the ''. This is what worked for me. Below,
      my update only worked when I took out the '' from around " & .Charge &
      ". Maybe somebody else can explain why.

      cnn.execute "Update tblCUSTOMER_FEE _STRUCTURE SET " & _
      "Charge = " & .Charge & " where " & _
      "ChargeCode = '" & .ChargeCode & "' and " & _
      "CustomerID = '" & .CustomerID & "'"
      [color=blue]
      > if (modcustomer == "relate")
      > {
      > var modid1 = Request.Form ("modid1");
      > var modid2 = Request.Form ("modid2");
      > var relationship = Request.Form ("relationship" );
      > var comments = Request.Form("c omments");
      >
      > SqlString = "UPDATE Customer SET Relationship = ' " + relationship + " '
      > WHERE ID = " + modid1;
      > connection.Exec ute (SqlString);
      >
      > }
      >
      > thanks,
      >
      > Debbie Ehrlich
      > Reliable Software - Developers of Code Co-op®, Server-less version control
      > for distributed teams www.relisoft.com[/color]

      Comment

      • debra ehrlich

        #4
        Re: Updating the database

        Thanks! I made this change as well and it works beautifully. My
        understanding is a numeral shouldn't have quotes around it. Only strings
        should have them.



        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        Working...