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. General Programming
  3. C#
  4. Please Help me!!!Thanks !!!

Please Help me!!!Thanks !!!

Scheduled Pinned Locked Moved C#
helpdatabase
3 Posts 3 Posters 1 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.
  • V Offline
    V Offline
    vandaivn
    wrote on last edited by
    #1

    i just create one database it's: create table HANGHOA ( MAHANG varchar(9) not null, TENHANG nvarchar(50) not null, DVDOLUONG nvarchar(15) not null, DINHLUONG int not null, DONVI nvarchar(15) not null, MOTA nvarchar(50) null , TONKHO int null , DGBAN int null , CANDUOI int null , constraint PK_HANGHOA primary key (MAHANG) ) When i created datagrid and add TENHANG to col1 : private void CreateDataGridStyle() { this.dataGrid1.ReadOnly=true; DGStyle = new DataGridTableStyle(); DGStyle.MappingName ="HANGHOA"; col1 = new DataGridTextBoxColumn(); col1.MappingName ="TENHANG"; col1.HeaderText = "TH"; col1.Width = 90; } but now i want to create table TH with three MappingName : "HANGHOA";"DVDOLUONG";"DINHLUONG" to one. Because when i create datagrid it's have 3 column but now i want to view it's one. private void CreateDataGridStyle() { this.dataGrid1.ReadOnly=true; DGStyle = new DataGridTableStyle(); DGStyle.MappingName ="HANGHOA"+"DINHLUONG"+"DVDOLUONG"; col1 = new DataGridTextBoxColumn(); col1.MappingName ="TENHANG"; col1.HeaderText = "TH"; col1.Width = 90; } ex: table first is HANGHOA DVDOLUONG DINHLUONG abc 1 st but end is "TableMapping" abc is 1st i said may be you can't understand but may be my "ex:" be you see the problem! Thanks !!!Please Help me!

    N G 2 Replies Last reply
    0
    • V vandaivn

      i just create one database it's: create table HANGHOA ( MAHANG varchar(9) not null, TENHANG nvarchar(50) not null, DVDOLUONG nvarchar(15) not null, DINHLUONG int not null, DONVI nvarchar(15) not null, MOTA nvarchar(50) null , TONKHO int null , DGBAN int null , CANDUOI int null , constraint PK_HANGHOA primary key (MAHANG) ) When i created datagrid and add TENHANG to col1 : private void CreateDataGridStyle() { this.dataGrid1.ReadOnly=true; DGStyle = new DataGridTableStyle(); DGStyle.MappingName ="HANGHOA"; col1 = new DataGridTextBoxColumn(); col1.MappingName ="TENHANG"; col1.HeaderText = "TH"; col1.Width = 90; } but now i want to create table TH with three MappingName : "HANGHOA";"DVDOLUONG";"DINHLUONG" to one. Because when i create datagrid it's have 3 column but now i want to view it's one. private void CreateDataGridStyle() { this.dataGrid1.ReadOnly=true; DGStyle = new DataGridTableStyle(); DGStyle.MappingName ="HANGHOA"+"DINHLUONG"+"DVDOLUONG"; col1 = new DataGridTextBoxColumn(); col1.MappingName ="TENHANG"; col1.HeaderText = "TH"; col1.Width = 90; } ex: table first is HANGHOA DVDOLUONG DINHLUONG abc 1 st but end is "TableMapping" abc is 1st i said may be you can't understand but may be my "ex:" be you see the problem! Thanks !!!Please Help me!

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

      3. Keep the subject line brief, but descriptive. eg "File Serialization problem" Please Help me!!!Thanks !!! may be brief but hardly descriptive.


      only two letters away from being an asset

      1 Reply Last reply
      0
      • V vandaivn

        i just create one database it's: create table HANGHOA ( MAHANG varchar(9) not null, TENHANG nvarchar(50) not null, DVDOLUONG nvarchar(15) not null, DINHLUONG int not null, DONVI nvarchar(15) not null, MOTA nvarchar(50) null , TONKHO int null , DGBAN int null , CANDUOI int null , constraint PK_HANGHOA primary key (MAHANG) ) When i created datagrid and add TENHANG to col1 : private void CreateDataGridStyle() { this.dataGrid1.ReadOnly=true; DGStyle = new DataGridTableStyle(); DGStyle.MappingName ="HANGHOA"; col1 = new DataGridTextBoxColumn(); col1.MappingName ="TENHANG"; col1.HeaderText = "TH"; col1.Width = 90; } but now i want to create table TH with three MappingName : "HANGHOA";"DVDOLUONG";"DINHLUONG" to one. Because when i create datagrid it's have 3 column but now i want to view it's one. private void CreateDataGridStyle() { this.dataGrid1.ReadOnly=true; DGStyle = new DataGridTableStyle(); DGStyle.MappingName ="HANGHOA"+"DINHLUONG"+"DVDOLUONG"; col1 = new DataGridTextBoxColumn(); col1.MappingName ="TENHANG"; col1.HeaderText = "TH"; col1.Width = 90; } ex: table first is HANGHOA DVDOLUONG DINHLUONG abc 1 st but end is "TableMapping" abc is 1st i said may be you can't understand but may be my "ex:" be you see the problem! Thanks !!!Please Help me!

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

        Your line: DGStyle.MappingName ="HANGHOA"+"DINHLUONG"+"DVDOLUONG"; is equivalent to: DGStyle.MappingName ="HANGHOADINHLUONGDVDOLUONG"; As there is no field by that name, it won't work. You have to concatenate the values when you query the data from the database, not when you specify your data grid.

        --- b { font-weight: normal; }

        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