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. Sintax problem

Sintax problem

Scheduled Pinned Locked Moved ASP.NET
databasehelpquestion
10 Posts 4 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.
  • M Offline
    M Offline
    Maxdd 7
    wrote on last edited by
    #1

    Let's say I have in index.aspx.cs Page_load():

    int id=1;

    And I have a gridview populated by MS SQL, and I have the following selectcommand:

    SelectCommand="SELECT * FROM [Filmes] WHERE [ID_Users]=' id '"

    I need to use that variable that way. Is it possible? What is the correct syntax? I tried many ways but cant do it. Really appreciate your help.

    _ 1 Reply Last reply
    0
    • M Maxdd 7

      Let's say I have in index.aspx.cs Page_load():

      int id=1;

      And I have a gridview populated by MS SQL, and I have the following selectcommand:

      SelectCommand="SELECT * FROM [Filmes] WHERE [ID_Users]=' id '"

      I need to use that variable that way. Is it possible? What is the correct syntax? I tried many ways but cant do it. Really appreciate your help.

      _ Offline
      _ Offline
      _Damian S_
      wrote on last edited by
      #2

      The syntax you are after is this: SelectCommand="SELECT * FROM [Filmes] WHERE [ID_Users]= " & id However, I would strongly recommend you use a stored procedure rather than SQL embedded in your code.

      I don't have ADHD, I have ADOS... Attention Deficit oooh SHINY!! Booger Mobile (n) - A bright green 1964 Ford Falcon - our entry into the Camp Quality esCarpade!! Do something wonderful - make a donation to Camp Quality today!!

      M 1 Reply Last reply
      0
      • _ _Damian S_

        The syntax you are after is this: SelectCommand="SELECT * FROM [Filmes] WHERE [ID_Users]= " & id However, I would strongly recommend you use a stored procedure rather than SQL embedded in your code.

        I don't have ADHD, I have ADOS... Attention Deficit oooh SHINY!! Booger Mobile (n) - A bright green 1964 Ford Falcon - our entry into the Camp Quality esCarpade!! Do something wonderful - make a donation to Camp Quality today!!

        M Offline
        M Offline
        Maxdd 7
        wrote on last edited by
        #3

        One step at the time :)

        N C 2 Replies Last reply
        0
        • M Maxdd 7

          One step at the time :)

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          You have been given this advise before. Time to take heed. If you want to learn how to code, learn it right.


          I know the language. I've read a book. - _Madmatt

          1 Reply Last reply
          0
          • M Maxdd 7

            One step at the time :)

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            Maxdd 7 wrote:

            One step at the time

            You say that and yet you post asking about every topic under the sun, without ever taking the time to properly learn anyting, or consider any of the good advice you are given

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            M 1 Reply Last reply
            0
            • C Christian Graus

              Maxdd 7 wrote:

              One step at the time

              You say that and yet you post asking about every topic under the sun, without ever taking the time to properly learn anyting, or consider any of the good advice you are given

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              M Offline
              M Offline
              Maxdd 7
              wrote on last edited by
              #6

              Well, Those are two different questions. Maybe I should read some things first, that is one mistake and I assume. Regarding the good advice I received, I consider them. I just no apply them for now, because I believe I should not try drive a truck, when I dont know how to drive a car.

              N C 2 Replies Last reply
              0
              • M Maxdd 7

                Well, Those are two different questions. Maybe I should read some things first, that is one mistake and I assume. Regarding the good advice I received, I consider them. I just no apply them for now, because I believe I should not try drive a truck, when I dont know how to drive a car.

                N Offline
                N Offline
                Not Active
                wrote on last edited by
                #7

                That's the point you are missing, you are trying to taught how to ride a bike before you get near the car.


                I know the language. I've read a book. - _Madmatt

                M 1 Reply Last reply
                0
                • N Not Active

                  That's the point you are missing, you are trying to taught how to ride a bike before you get near the car.


                  I know the language. I've read a book. - _Madmatt

                  M Offline
                  M Offline
                  Maxdd 7
                  wrote on last edited by
                  #8

                  I know you are right I'm just trying to make you understand my point of view. Until some days ago, I never coded a line of C# and used ASP.NET controls. I dont have a book (or e-book) or anyone I know who could teach me. The few I learn, was throught google, and even by google it could be difficult find the information I need. There are so many things of ASP.NET (I never imagined!), and then exists .NET 1.1, 2.0, 3.0 (...) VB.NET, older versions, near versions (...) Sometimes it could be difficult start coding in this conditions, because I dont know where to stand, where to look. But ok, from now on, I will try to follow your advices, and just post questions (if necessary) about it. My apologies for any incovenience.

                  C 1 Reply Last reply
                  0
                  • M Maxdd 7

                    Well, Those are two different questions. Maybe I should read some things first, that is one mistake and I assume. Regarding the good advice I received, I consider them. I just no apply them for now, because I believe I should not try drive a truck, when I dont know how to drive a car.

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #9

                    Maxdd 7 wrote:

                    I just no apply them for now, because I believe I should not try drive a truck, when I dont know how to drive a car.

                    Your problem is that you choose to drive the truck instead of starting with the damn car.

                    Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                    1 Reply Last reply
                    0
                    • M Maxdd 7

                      I know you are right I'm just trying to make you understand my point of view. Until some days ago, I never coded a line of C# and used ASP.NET controls. I dont have a book (or e-book) or anyone I know who could teach me. The few I learn, was throught google, and even by google it could be difficult find the information I need. There are so many things of ASP.NET (I never imagined!), and then exists .NET 1.1, 2.0, 3.0 (...) VB.NET, older versions, near versions (...) Sometimes it could be difficult start coding in this conditions, because I dont know where to stand, where to look. But ok, from now on, I will try to follow your advices, and just post questions (if necessary) about it. My apologies for any incovenience.

                      C Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #10

                      Maxdd 7 wrote:

                      Until some days ago, I never coded a line of C# and used ASP.NET controls.

                      Which means you're an idiot for trying ASP.NET at all. You need good C# first.

                      Maxdd 7 wrote:

                      I dont have a book

                      If you can't buy one, then at least recognise what the right sequence is. I taught myself and I started with C++, then learned MFC. No-one told me that, it was common sense.

                      Maxdd 7 wrote:

                      . The few I learn, was throught google, and even by google it could be difficult find the information I need.

                      99% of the questions asked here, it's trivial to get answers with google. The problem is you're trying to ask complex questions, before knowing the answers to the easy ones.

                      Maxdd 7 wrote:

                      There are so many things of ASP.NET (I never imagined!), and then exists .NET 1.1, 2.0, 3.0 (...) VB.NET, older versions, near versions (...) Sometimes it could be difficult start coding in this conditions, because I dont know where to stand, where to look.

                      C#. Ignore VB.NET. Learn basic C#, preferably writing console apps. Then you could progress to web pages, perhaps. Don't even try to learn SQL before you know C# really well. Don't even think of ASP.NET before you learn the language that drives it.

                      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                      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