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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. PLease, i need your help

PLease, i need your help

Scheduled Pinned Locked Moved ASP.NET
4 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.
  • A Offline
    A Offline
    Ahmed EL Gendy
    wrote on last edited by
    #1

    this is a sampil code of my project how can make the data source read from variable tables ? Ex: x = TableName SelectCommand="SELECT [ReprotDate], [UserName], [ProjectName], [Report]FROM X"> how can i do this in asp.net V 2.0 ??? Best Regards Ahmed EL GEndy

    N T G 3 Replies Last reply
    0
    • A Ahmed EL Gendy

      this is a sampil code of my project how can make the data source read from variable tables ? Ex: x = TableName SelectCommand="SELECT [ReprotDate], [UserName], [ProjectName], [Report]FROM X"> how can i do this in asp.net V 2.0 ??? Best Regards Ahmed EL GEndy

      N Offline
      N Offline
      Naveed Kamboh
      wrote on last edited by
      #2

      x="Tablename" Using C# sqlcommand="Select field1,field2 from " + x + " order by field1"; Make sure that you put space after from and before order by clause.

      Naveed Kamboh Complexity kills, Write easy code for your self. isolutionteam

      1 Reply Last reply
      0
      • A Ahmed EL Gendy

        this is a sampil code of my project how can make the data source read from variable tables ? Ex: x = TableName SelectCommand="SELECT [ReprotDate], [UserName], [ProjectName], [Report]FROM X"> how can i do this in asp.net V 2.0 ??? Best Regards Ahmed EL GEndy

        T Offline
        T Offline
        ToddHileHoffer
        wrote on last edited by
        #3

        I would NOT code it that way. Create a different stored procedures (or one with a tableName as a paramter). Use a switch statement to chose your stored procedure. Dynamic SQL should only be done if absolutely necessary. First of all, performance will be better if it stored procedures. Secondly, stored procedures prevent SQL Injection. Third, maintenance will be easier, especially if you change a table. Fourth, if someone else sees your code, they won't think you are a complete beginner.

        GameFly free trial

        1 Reply Last reply
        0
        • A Ahmed EL Gendy

          this is a sampil code of my project how can make the data source read from variable tables ? Ex: x = TableName SelectCommand="SELECT [ReprotDate], [UserName], [ProjectName], [Report]FROM X"> how can i do this in asp.net V 2.0 ??? Best Regards Ahmed EL GEndy

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

          Why do you have separate tables with the same type of data in them in the first place? Why isn't the data in a single table?

          --- single minded; short sighted; long gone;

          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