@ Parameter Question

Discussion in 'ASP .Net Web Controls' started by TJHerman, Jul 12, 2006.

  1. TJHerman

    TJHerman Guest

    I'm trying to understand where a SQLDataSource control gets the value for the
    @ parameter that it passes to its sql action queries.

    I have a page where the insert and update work just fine and find a
    "@CompanyID" value to use on the sql statements but when I try to do a
    delete, I get an error page with the message:

    Exception Details: System.Data.SqlClient.SqlException: Must declare the
    variable '@CompanyID'.

    Can anyone tell me where this value comes from and/or what I should be
    looking for to fix my problem?

    Thanks very much!
     
    TJHerman, Jul 12, 2006
    #1
    1. Advertising

  2. TJHerman

    Riki Guest

    TJHerman wrote:
    > I'm trying to understand where a SQLDataSource control gets the value
    > for the @ parameter that it passes to its sql action queries.
    >
    > I have a page where the insert and update work just fine and find a
    > "@CompanyID" value to use on the sql statements but when I try to do a
    > delete, I get an error page with the message:
    >
    > Exception Details: System.Data.SqlClient.SqlException: Must declare
    > the variable '@CompanyID'.
    >
    > Can anyone tell me where this value comes from and/or what I should be
    > looking for to fix my problem?


    It should be under <DeleteParameters>

    --

    Riki
     
    Riki, Jul 13, 2006
    #2
    1. Advertising

  3. TJHerman

    TJHerman Guest

    Thanks very much for your response. It actually turned out to be that somehow
    I didn't have a Datakeyname value defined on my formview.

    "Riki" wrote:

    > TJHerman wrote:
    > > I'm trying to understand where a SQLDataSource control gets the value
    > > for the @ parameter that it passes to its sql action queries.
    > >
    > > I have a page where the insert and update work just fine and find a
    > > "@CompanyID" value to use on the sql statements but when I try to do a
    > > delete, I get an error page with the message:
    > >
    > > Exception Details: System.Data.SqlClient.SqlException: Must declare
    > > the variable '@CompanyID'.
    > >
    > > Can anyone tell me where this value comes from and/or what I should be
    > > looking for to fix my problem?

    >
    > It should be under <DeleteParameters>
    >
    > --
    >
    > Riki
    >
    >
    >
     
    TJHerman, Jul 13, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    521
    Matteo
    Mar 29, 2007
  2. Stuart Redmann
    Replies:
    5
    Views:
    481
    Stuart Redmann
    Dec 14, 2007
  3. Replies:
    5
    Views:
    639
  4. Isti
    Replies:
    2
    Views:
    724
  5. Mister B
    Replies:
    8
    Views:
    554
    Nick Keighley
    Aug 26, 2010
Loading...

Share This Page