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. display Dynamic sql in gridview

display Dynamic sql in gridview

Scheduled Pinned Locked Moved ASP.NET
databasexmlhelp
3 Posts 2 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
    amina89
    wrote on last edited by
    #1

    Hi, the following query # DECLARE @MATIERE nvarchar(max) # SELECT @MATIERE = # STUFF( # ( # select distinct ',[' + LIBELLE_MATIERE + ']' # from MATIERE where CODE_MODULE =11 # for xml path('') # ), # 1,1,'') # # DECLARE @SQL nvarchar(max) # SELECT @SQL = N' # select # * # from ( # # SELECT ETUDIANT.NUM_INSCRIPTION, ETUDIANT.NOM_PRENOM_ETUDIANT_ARABE,EXAMEN.CODE, # EXAMEN.NOTE, # MATIERE.LIBELLE_MATIERE # FROM ETUDIANT INNER JOIN # EXAMEN ON ETUDIANT.NUM_INSCRIPTION = EXAMEN.NUM_INSCRIPTION INNER JOIN # CAPITALISE_MODULE ON # ETUDIANT.NUM_INSCRIPTION = CAPITALISE_MODULE.NUM_INSCRIPTION INNER JOIN # MATIERE ON EXAMEN.CODE_MATIERE = MATIERE.CODE_MATIERE INNER JOIN # MODULE ON CAPITALISE_MODULE.CODE_MODULE = MODULE.CODE_MODULE # AND MATIERE.CODE_MODULE = MODULE.CODE_MODULE # WHERE (CAPITALISE_MODULE.CODE_MODULE = 11) AND # (CAPITALISE_MODULE.CODE_TYPE_RELATION_MODULE = 1) # ) Data # PIVOT ( # SUM(NOTE) # FOR LIBELLE_MATIERE # IN ( # ' + @MATIERE + ' # ) # ) PivotTable # ' # # exec sp_executesql @SQL this query shows this: num-inscription__NOM_PRENOM__subject1_____subject2_____ I want to display in a gridview with all columns are in edit mode except num_inscription and nom_prenom and then insert all in database . Help me please. Thanks

    S 1 Reply Last reply
    0
    • A amina89

      Hi, the following query # DECLARE @MATIERE nvarchar(max) # SELECT @MATIERE = # STUFF( # ( # select distinct ',[' + LIBELLE_MATIERE + ']' # from MATIERE where CODE_MODULE =11 # for xml path('') # ), # 1,1,'') # # DECLARE @SQL nvarchar(max) # SELECT @SQL = N' # select # * # from ( # # SELECT ETUDIANT.NUM_INSCRIPTION, ETUDIANT.NOM_PRENOM_ETUDIANT_ARABE,EXAMEN.CODE, # EXAMEN.NOTE, # MATIERE.LIBELLE_MATIERE # FROM ETUDIANT INNER JOIN # EXAMEN ON ETUDIANT.NUM_INSCRIPTION = EXAMEN.NUM_INSCRIPTION INNER JOIN # CAPITALISE_MODULE ON # ETUDIANT.NUM_INSCRIPTION = CAPITALISE_MODULE.NUM_INSCRIPTION INNER JOIN # MATIERE ON EXAMEN.CODE_MATIERE = MATIERE.CODE_MATIERE INNER JOIN # MODULE ON CAPITALISE_MODULE.CODE_MODULE = MODULE.CODE_MODULE # AND MATIERE.CODE_MODULE = MODULE.CODE_MODULE # WHERE (CAPITALISE_MODULE.CODE_MODULE = 11) AND # (CAPITALISE_MODULE.CODE_TYPE_RELATION_MODULE = 1) # ) Data # PIVOT ( # SUM(NOTE) # FOR LIBELLE_MATIERE # IN ( # ' + @MATIERE + ' # ) # ) PivotTable # ' # # exec sp_executesql @SQL this query shows this: num-inscription__NOM_PRENOM__subject1_____subject2_____ I want to display in a gridview with all columns are in edit mode except num_inscription and nom_prenom and then insert all in database . Help me please. Thanks

      S Offline
      S Offline
      Sandeep Mewara
      wrote on last edited by
      #2

      amina89 wrote:

      I want to display in a gridview with all columns are in edit mode except num_inscription and nom_prenom

      If by default you want to show grid id edit mode, then use textboxes for subject1 & subject2 in ItemTemplate. Use labels for num_inscription & nom_prenom. Use standard way to insert the data. If you have an event to change normal gridview to edit mode then, use textboxes for the editable fields in EditTemplate and labels for non-editable in edittemplate. On update of row, insert the data in database.

      A 1 Reply Last reply
      0
      • S Sandeep Mewara

        amina89 wrote:

        I want to display in a gridview with all columns are in edit mode except num_inscription and nom_prenom

        If by default you want to show grid id edit mode, then use textboxes for subject1 & subject2 in ItemTemplate. Use labels for num_inscription & nom_prenom. Use standard way to insert the data. If you have an event to change normal gridview to edit mode then, use textboxes for the editable fields in EditTemplate and labels for non-editable in edittemplate. On update of row, insert the data in database.

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

        Hi; but I do not know the number of subjects that is the title and the number of columns. Thanks.

        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