沈泽
2021-11-04 b940d23655d3e814fe0bc92ccc63f688d9cae7c3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
 
namespace BLL
{
    public partial class FrmAutoSQL : Form
    {
        public FrmAutoSQL()
        {
            InitializeComponent();
        }
 
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
 
        private void cmdOk_Click(object sender, EventArgs e)
        {
            
 
 
        }
 
 
        public void GetBaseInsertSQL()
        {
            //
            string SQLHead;
            string SQLFiled;
            string SQLValue;
            //
            SQLHead = "Insert Into " + txtHBaseTableName + " (";
            //¸ù¾Ý±íÍ·ÕÒµ½ ËùÓÐ×Ö¶Î
            DataSet ds;
            ds=oCn.RunProcReturn("select a.name hname,a.length,b.name htypename From SysColumns a inner join " + 
                   " systypes b on a.xtype=b.xtype  Where ID=Object_Id('"+txtHBaseTableName.Text+"')  " +
                   " order by a.name","SysColumns");
            if (ds == null || ds.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("ÊäÈëµÄ±íÃû²»ÕýÈ·£¡");
                return;
            }
            SQLFiled = "";
            SQLValue = "";
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                //Æ´½Ó×Ö¶Î
                SQLFiled = SQLFiled + "," + ds.Tables[0].Rows[i]["HName"].ToString();
                //Æ´½Ó×Ö¶ÎÖµ
                SQLValue = SQLValue + "," + GetStrByType(ds.Tables[0].Rows[i]["HName"].ToString(), ds.Tables[0].Rows[i]["htypename"].ToString());
 
            }
        }
 
        public string GetStrByType(string HName,string HType)
        {
            return "";
            //switch ( HType.ToLower())
            //{
            //    case "int":
            //    case "smallint":
            //        return "oModel."+HName+".ToString()";
            //        break;
            //    case "":
            //    case "":
 
            //        break;
            //    default:
 
            //        break;
            //}
        }
    }
}