在我的數據庫,我是5桌與名字的孩子',「個人」,「配偶」,「occup_contact」,「res_contact」與列名如何更改c#中datagridview的列名?
children(pid,pnochild,pcname,pcblood,pcdob)
occup_contact(pid,poccup_nature,poccup_type,poccup_add,pemail,poccup_phone,poccup_mobile)
personal(pid,pname,pfname,pmname,pfhname,pdob,pgender,pedulvl,pedu,pblood,gotra,panth,pmarritalstatus)
res_contact (pid,pres_add,pres_phone,pres_mobile)
spouse (pid,psname,psedulvl,psedu,psblood,psdob)
然後我的形式我拖着一個數據網格視圖在這我想加入與修改後的列名像
name not 'pname' it should be Name
fathername not 'pfname' it should be Father's Name........so on
和select語句我應該用它來獲得加入基於個人的即PNAME列名的所有表的結果,所有這些這些表的結果個人表的pid列是主鍵並且全部用作外鍵的個人表的個人表其他表格。所有的表都依賴於個人的桌子
我在select語句 防爆用這個
cmd.CommandText = "select p.pname as 'Name',p.pfname as 'Father Name' ,p.pmname as 'Mother Name',p.pfhname as 'Family Head Name',p.pdob as 'Date of Birth',p.pgender as 'Gender',p.pedulvl as 'Education',p.pedu as 'Degree',p.pblood as 'Blood Group',p.gotra as 'Gotra',p.panth as 'Panth',p.pmarritalstatus as 'Marrital Status',s.psname as 'Spouse Name',s.psedulvl as 'Spouse Edu. Degree',s.psedu as 'Spouse Education',s.psblood as 'Spouse Blood Group',s.psdob as 'Spouse Date of Birth',c.pnochild as 'Number of Children',c.pcname as 'Child Name',c.pcblood as 'Child Blood Group',c.pcdob as 'Child Date of Birth',r.pres_add as 'Resident Address',pres_phone as 'Resident Ph.no ',pres_mobile as 'Resident Mobile no.',o.poccup_nature as 'Nature of Occupation',o.poccup_type as 'Type of Occupation',o.poccup_add as 'Office Address',o.pemail as 'Email id',o.poccup_phone as 'Office Ph.no',o.poccup_mobile as 'Office Mobile number'from personal as p join spouse as s on p.pid=s.pid join children as c on p.pid=c.pid join occup_contact as o on p.pid=o.pid join res_contact as r on p.pid=r.pid where pname='" + viewtxt.Text + "' ";
這是在Windows窗體或Web應用程序?我只想確認一下。 – Musikero31 2013-04-30 16:06:53
窗體窗體應用程序 – user2327043 2013-04-30 16:16:30