From 3650eaeba0cc130b5ec961bb7684b45ff3fa9415 Mon Sep 17 00:00:00 2001
From: lg <999544862qq.com>
Date: 星期一, 16 九月 2024 20:54:39 +0800
Subject: [PATCH] 打包安装

---
 DevApp/Gs.DevApp/DevFrm/Sys/EasyCode.cs |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/Sys/EasyCode.cs b/DevApp/Gs.DevApp/DevFrm/Sys/EasyCode.cs
index 92eedd6..ae9b595 100644
--- a/DevApp/Gs.DevApp/DevFrm/Sys/EasyCode.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Sys/EasyCode.cs
@@ -95,13 +95,21 @@
         private DataTable _getCol()
         {
             string strConn = txt_sqlconn.Text.Trim();
+            System.Text.StringBuilder sb = new StringBuilder();
+            sb.Append("SELECT COLUMN_NAME = a.name, DATA_TYPE = b.name, REMARK = isnull(g.[value],a.name) ");
+            sb.Append(" FROM syscolumns a  left join systypes b on a.xusertype = b.xusertype inner join sysobjects d on a.id = d.id and d.xtype = 'U'  and d.name<>'dtproperties' ");
+            sb.Append(" left join syscomments e on a.cdefault = e.id ");
+            sb.Append("  left join sys.extended_properties g on a.id = G.major_id and a.colid = g.minor_id ");
+            sb.Append(" left join sys.extended_properties f on d.id = f.major_id and f.minor_id = 0 ");
+            sb.Append(" where d.name = '" + txt_table.SelectedValue.ToString() + "'");
+            sb.Append(" order by  a.id, a.colorder");
             DataSet dset = new DataSet();
             using (SqlConnection connection = new SqlConnection(strConn))
             {
                 connection.Open();
                 SqlCommand cmd = new SqlCommand();
                 cmd.Connection = connection;
-                cmd.CommandText = "SELECT COLUMN_NAME,DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'" + txt_table.SelectedValue.ToString() + "'";
+                cmd.CommandText = sb.ToString();
                 using (SqlDataAdapter dt = new SqlDataAdapter(cmd))
                 {
                     dt.Fill(dset, "0");
@@ -168,7 +176,7 @@
             if (dt.Rows.Count > 0)
             {
                 string _FieldName = "";//瀛楁鍚�
-                string _FieldText = "";//
+                string _FieldText = "";//瀛楁鏂囨湰
                 string _prefix = "txt_";
                 string _Lbfix = "lb_";
                 string _gvFix = "gv_";
@@ -190,8 +198,9 @@
                         case "1111":
                             break;
                         default:
-                            _FieldName = ToolBox.UtilityHelper.ToCamelCase(dt.Rows[c]["COLUMN_NAME"].ToString());
-                            _FieldText = ToolBox.UtilityHelper.ToCamelCase(dt.Rows[c]["COLUMN_NAME"].ToString());
+                            string _tf = ToolBox.UtilityHelper.ToCamelCase(dt.Rows[c]["COLUMN_NAME"].ToString());
+                            _FieldName = _tf;
+                            _FieldText = dt.Rows[c]["REMARK"].ToString();
                             _ControlType = "TextEdit";
                             break;
                     }
@@ -222,7 +231,7 @@
                              + "this." + _labName + ".TabIndex = " + _Tabindex + ";" + line
                              + "this." + _labName + ".Tag = " + _FieldName02 + ";" + line//Tag鍊�
                              + "this." + _labName + ".Appearance.Font = new System.Drawing.Font(\"Tahoma\", 10F);" + line
-                            + "this." + _labName + ".Text = " + _FieldText02 + ";" + line
+                            + "this." + _labName + ".Text = " + (_FieldText02) + ";" + line
                             //鏂囨湰 
                             + "//" + line
                             + "//" + _ControlName + line
@@ -237,11 +246,13 @@
                            + "this." + _gvName + ".AppearanceCell.Font = new System.Drawing.Font(\"Tahoma\", 10F);" + line
                            + "this." + _gvName + ".AppearanceCell.Options.UseFont = true;" + line
                            + "this." + _gvName + ".FieldName = " + _FieldName02 + ";" + line
-                           + "this." + _gvName + ".Caption = " + _FieldName02 + ";" + line
+                           + "this." + _gvName + ".Caption = " + _FieldText02 .Replace("锛�","")+ ";" + line
                            + "this." + _gvName + ".MinWidth = 25;" + line
                            + "this." + _gvName + ".Visible = true;" + line
                            + "this." + _gvName + ".Width =94;" + line
+                           + "this." + _gvName + ".OptionsColumn.AllowEdit = false;" + line
                            + "this." + _gvName + ".VisibleIndex = 0;" + line;
+
 
                     strbuilder.Replace("BQSetControlInfo", BQSetControlInfo);
                     //BQAddControltoMContainer//灏嗘帶浠舵坊鍔犲埌Form 瀹瑰櫒涓�  杩欎釜瀹瑰櫒鍙互鏄� panel 鍙互鏄痝roupbox 绛夌瓑 
@@ -289,5 +300,10 @@
             txtCreateDBPath.Text = _GetfilePath;
         }
 
+        private void button1_Click(object sender, EventArgs e)
+        {
+            EasyRpt frm = new EasyRpt("001");
+            frm.Show();
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3