Explorar el Código

添加sp数据库

DuGuYang hace 3 años
padre
commit
909f1c6b8b
Se han modificado 1 ficheros con 26 adiciones y 0 borrados
  1. 26 0
      Startup.cs

+ 26 - 0
Startup.cs

@@ -93,8 +93,10 @@ namespace MySystem
             initMainServer();
             initMainServer();
             initBsServer();
             initBsServer();
             initCashServer();
             initCashServer();
+            initSpServer();
 
 
             RedisDbconn.csredis = new CSRedis.CSRedisClient(Configuration["Setting:RedisConnStr"]);
             RedisDbconn.csredis = new CSRedis.CSRedisClient(Configuration["Setting:RedisConnStr"]);
+            // TendisDbconn.csredis = new CSRedis.CSRedisClient(Configuration["Setting:TendisConnStr"]);
         }
         }
 
 
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -217,5 +219,29 @@ namespace MySystem
             Library.OtherMySqlConn.connstr = "";
             Library.OtherMySqlConn.connstr = "";
             PublicFunction.CashTables = tables;
             PublicFunction.CashTables = tables;
         }
         }
+
+        private void initSpServer()
+        {
+            Dictionary<string, Dictionary<string, string>> tables = new Dictionary<string, Dictionary<string, string>>();
+            Library.OtherMySqlConn.connstr = Configuration["Setting:SpSqlConnStr"];
+            System.Data.DataTable tablecollection = Library.OtherMySqlConn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = 'KxsSpServer'");
+            foreach (System.Data.DataRow subtable in tablecollection.Rows)
+            {
+                Dictionary<string, string> Columns = new Dictionary<string, string>();
+                System.Data.DataTable columncollection = Library.OtherMySqlConn.dtable("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_schema = 'KxsSpServer' and TABLE_NAME='" + subtable["TABLE_NAME"].ToString() + "'");
+                foreach (System.Data.DataRow column in columncollection.Rows)
+                {
+                    string datatype = column["DATA_TYPE"].ToString();
+                    if (datatype == "decimal")
+                    {
+                        datatype = "numeric";
+                    }
+                    Columns.Add(column["COLUMN_NAME"].ToString(), datatype);
+                }
+                tables.Add(subtable["TABLE_NAME"].ToString(), Columns);
+            }
+            Library.OtherMySqlConn.connstr = "";
+            PublicFunction.SpTables = tables;
+        }
     }
     }
 }
 }