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. Database & SysAdmin
  3. Database
  4. Replace SELECT result before datagrid.

Replace SELECT result before datagrid.

Scheduled Pinned Locked Moved Database
csstutorialquestiondiscussionannouncement
3 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.
  • J Offline
    J Offline
    japel
    wrote on last edited by
    #1

    Hi I have the below sub the reads a single row table and populates the results in a data grid. Some of the fields have numerical values to represent settings. E.G. SecurityLevel 1 1 may be admin, so how to I replace the 1 with admin before I populate my datagrid? Dim Command1 As SqlCommand = New SqlCommand("SELECT [Name], Type, SecurityLevel, Version, CreatedDateTime, Driver, CabinetType, NetworkAddress, LoginFlag, DomainName, AuthenticationType, WebServerAddress FROM dbtab") Command1.CommandType = CommandType.Text Command1.Connection = SQLConnection1 myDataSet = New DataSet("myDataSet") SQLAdapter1.SelectCommand = Command1 SQLAdapter1.Fill(myDataSet, "Document") DataGrid2.SetDataBinding(myDataSet, "Document") About 4 of the Columns in the above select statment have values that I would like to replace bases on a lookup list. OK BIG point I CAN NOT make an intermediate table :-) Any thoughts When people make you see red, be thankful your not colour blind.

    M 1 Reply Last reply
    0
    • J japel

      Hi I have the below sub the reads a single row table and populates the results in a data grid. Some of the fields have numerical values to represent settings. E.G. SecurityLevel 1 1 may be admin, so how to I replace the 1 with admin before I populate my datagrid? Dim Command1 As SqlCommand = New SqlCommand("SELECT [Name], Type, SecurityLevel, Version, CreatedDateTime, Driver, CabinetType, NetworkAddress, LoginFlag, DomainName, AuthenticationType, WebServerAddress FROM dbtab") Command1.CommandType = CommandType.Text Command1.Connection = SQLConnection1 myDataSet = New DataSet("myDataSet") SQLAdapter1.SelectCommand = Command1 SQLAdapter1.Fill(myDataSet, "Document") DataGrid2.SetDataBinding(myDataSet, "Document") About 4 of the Columns in the above select statment have values that I would like to replace bases on a lookup list. OK BIG point I CAN NOT make an intermediate table :-) Any thoughts When people make you see red, be thankful your not colour blind.

      M Offline
      M Offline
      Michael Potter
      wrote on last edited by
      #2

      Replace SecurityLevel in your Sql statement with a case statement structured as needed. CASE WHEN SecurityLevel = 1 THEN 'Administrator' WHEN SecurityLevel = 2 THEN 'Supervisior' ELSE 'User' END As SecurityLevel,

      A 1 Reply Last reply
      0
      • M Michael Potter

        Replace SecurityLevel in your Sql statement with a case statement structured as needed. CASE WHEN SecurityLevel = 1 THEN 'Administrator' WHEN SecurityLevel = 2 THEN 'Supervisior' ELSE 'User' END As SecurityLevel,

        A Offline
        A Offline
        Alomgir Miah
        wrote on last edited by
        #3

        http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.webcontrols/browse\_thread/thread/e3de64786d1684a2/be32e7aefcb96da6?lnk=st&q=DataGrid+display+custom+value&rnum=1&hl=en#be32e7aefcb96da6 Live Life King Size Alomgir Miah

        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