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;
|
//}
|
}
|
}
|
}
|