Update Query with a Public variable.

Last post 12-14-2006 12:09 PM by FSousa. 2 replies.

Sort Posts:

  • Update Query with a Public variable.

    12-13-2006, 9:08 PM
    • Loading...
    • FSousa
    • Joined on 11-22-2006, 9:14 PM
    • Posts 8

    Hi,

    One of my pages I have a GridView and a FormView, the FormView is displayed every time the user selects one item in the Gridview. That same user as to be logged in to be able to access this page.

    If the user wants to Edit the information and Update the database I need the login name to be included in that Update Query.

    I have that login name as a public variable and I'm able to show that information in the formview as soon as the user clicks Edit, but I'm not able to save it to the database... all the rest is updated but the username gets a NULL.

    I'm not binding the variable with my Update... How do I do that? Any example available or any tutorial?

    Thank you all

    FSousa

  • Re: Update Query with a Public variable.

    12-13-2006, 9:48 PM
    • Loading...
    • rexlin
    • Joined on 07-17-2006, 8:43 AM
    • Posts 1,751

    Hi, FSousa:

    You can add the updateparameter of username in the updateparameter collection of datasource and assign the value in the ItemUpdating event.

    protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
                e.NewValues["username"]= //your local variable
        }

     



    Best Regards,
    __________________________________________________
    Sincerely,
    Rex Lin
    Microsoft Online Community Support

    This posting is provided "AS IS" with on warranties, and confers no rights.
  • Re: Update Query with a Public variable.

    12-14-2006, 12:09 PM
    Answer
    • Loading...
    • FSousa
    • Joined on 11-22-2006, 9:14 PM
    • Posts 8

    Rex, your the best... Thank you soo much for your help.

     

Page 1 of 1 (3 items)
Microsoft Communities
Page view counter