Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Gridview/DropDownList problem. Simple problem, I think [modified]

Gridview/DropDownList problem. Simple problem, I think [modified]

Scheduled Pinned Locked Moved ASP.NET
helpdatabase
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aqzman_
    wrote on last edited by
    #1

    Hey guys, I'm having a little problem with my drop down list and gridview. I used the drop down list to select what data is going to be shown in the gridview, it was working fine earlier but I changed the SQL string around a little bit and it went all haywire. Usually I back up my data every few hours, but just as my luck would have it, last time I backed up was right before I started that form. The error I'm getting is "Must declare the scalar variable "@Name".", but I thought it was declared, I must have a line left out in the drop down list settings. Here is the code that I think matters. If I'm leaving any out please let me know!

    Thanks, aqzman Edit: Just thought this might help elimate some problems. When I run this code without the "AND tblUsers.Name = @Name" code the gridview and drop down list both fill up with all the data they need to, but obvisiouly none of the data in the gridview is filtered

    G S 2 Replies Last reply
    0
    • A aqzman_

      Hey guys, I'm having a little problem with my drop down list and gridview. I used the drop down list to select what data is going to be shown in the gridview, it was working fine earlier but I changed the SQL string around a little bit and it went all haywire. Usually I back up my data every few hours, but just as my luck would have it, last time I backed up was right before I started that form. The error I'm getting is "Must declare the scalar variable "@Name".", but I thought it was declared, I must have a line left out in the drop down list settings. Here is the code that I think matters. If I'm leaving any out please let me know!

      Thanks, aqzman Edit: Just thought this might help elimate some problems. When I run this code without the "AND tblUsers.Name = @Name" code the gridview and drop down list both fill up with all the data they need to, but obvisiouly none of the data in the gridview is filtered

      G Offline
      G Offline
      gauthee
      wrote on last edited by
      #2

      How are you providing value to @Name?

      Gautham

      A 1 Reply Last reply
      0
      • G gauthee

        How are you providing value to @Name?

        Gautham

        A Offline
        A Offline
        aqzman_
        wrote on last edited by
        #3

        Hi, thanks a lot for your reply! I never changed any code with the dropdownlist, and that's where I thought where the value was getting assigned to @Name. I just noticed that not all the code for the drop down list is getting displayed in my first post for some reason. Here is the drop down list code.

        G 1 Reply Last reply
        0
        • A aqzman_

          Hi, thanks a lot for your reply! I never changed any code with the dropdownlist, and that's where I thought where the value was getting assigned to @Name. I just noticed that not all the code for the drop down list is getting displayed in my first post for some reason. Here is the drop down list code.

          G Offline
          G Offline
          gauthee
          wrote on last edited by
          #4

          Hi, I want you to check your command text, i.e. your select query. In your select query after the and condition you are using the variable @name , how is the value getting substituted to that @name? Dont you have to add this parameter to the command?

          Gautham

          A 1 Reply Last reply
          0
          • G gauthee

            Hi, I want you to check your command text, i.e. your select query. In your select query after the and condition you are using the variable @name , how is the value getting substituted to that @name? Dont you have to add this parameter to the command?

            Gautham

            A Offline
            A Offline
            aqzman_
            wrote on last edited by
            #5

            Thanks again for the reply. Well this is actually sort of strange, but good at the same time I guess. I made of copy of that page when it was working and it was saved in a folder, so I forgot about it. Anyway, that page is working fine, but the strangest thing is that I carried over all the code, and even checked the settings, they all match. One works, and the other doesn't. There is no value getting put into the @name on either page, the only time the actual phrase "@Name" is being used is in the selet query. Should I just write some code to assign the currently selected item in the drop down list to the @Name instead of just wondering how one page works? Haha. Thanks, aqzman

            G 1 Reply Last reply
            0
            • A aqzman_

              Thanks again for the reply. Well this is actually sort of strange, but good at the same time I guess. I made of copy of that page when it was working and it was saved in a folder, so I forgot about it. Anyway, that page is working fine, but the strangest thing is that I carried over all the code, and even checked the settings, they all match. One works, and the other doesn't. There is no value getting put into the @name on either page, the only time the actual phrase "@Name" is being used is in the selet query. Should I just write some code to assign the currently selected item in the drop down list to the @Name instead of just wondering how one page works? Haha. Thanks, aqzman

              G Offline
              G Offline
              gauthee
              wrote on last edited by
              #6

              What i would say first leave the form with its functionality working then start your research and try to pass the value. But strange though!!!:omg:

              Gautham

              A 1 Reply Last reply
              0
              • G gauthee

                What i would say first leave the form with its functionality working then start your research and try to pass the value. But strange though!!!:omg:

                Gautham

                A Offline
                A Offline
                aqzman_
                wrote on last edited by
                #7

                Yup, I'll just throw everything on the working form. Thanks for the help!

                1 Reply Last reply
                0
                • A aqzman_

                  Hey guys, I'm having a little problem with my drop down list and gridview. I used the drop down list to select what data is going to be shown in the gridview, it was working fine earlier but I changed the SQL string around a little bit and it went all haywire. Usually I back up my data every few hours, but just as my luck would have it, last time I backed up was right before I started that form. The error I'm getting is "Must declare the scalar variable "@Name".", but I thought it was declared, I must have a line left out in the drop down list settings. Here is the code that I think matters. If I'm leaving any out please let me know!

                  Thanks, aqzman Edit: Just thought this might help elimate some problems. When I run this code without the "AND tblUsers.Name = @Name" code the gridview and drop down list both fill up with all the data they need to, but obvisiouly none of the data in the gridview is filtered

                  S Offline
                  S Offline
                  sidbaruah
                  wrote on last edited by
                  #8

                  SelectCommand=" Declare @Name varchar SELECT *FROM tblCallers, tblTicket, tblUsersWHERE tblTicket.TicketID = tblCallers.TicketID AND tblTicket.UserID = tblUsers.UserID AND tblUsers.Name = @Name";

                  I was born dumb!! :laugh:Programming made me laugh:laugh:!!! --sid--

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups