日期:2014-05-17  浏览次数:20567 次

csnd怎么发图片!发代码怎么让代码变色![code=C#][/code]怎么用!
//欢迎加入.net mvc3交流群【198031493】
/*****************************/
public partial class _Default : System.Web.UI.Page
{
  private string connStr =
  "Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3};Pooling=False;charset=utf8;" +
  "MAX Pool Size=2000;Min Pool Size=1;Connection Lifetime=30;";

  private string conn = ConfigurationManager.ConnectionStrings["owa"].ConnectionString;

  private readonly string gettables = "select table_name from information_schema.tables where table_schema='{0}'";

  private readonly string getflieds =
  "select column_name name,data_type type,COLUMN_TYPE,column_comment as info,extra as auto,CHARACTER_MAXIMUM_LENGTH as len " +
  "from INFORMATION_SCHEMA.COLUMNS Where table_name ='{0}' and table_schema ='{1}'";

  public int z = 0;
  protected void Page_Load(object sender, EventArgs e)
  {
  if (!IsPostBack)
  {
  txt_namespace.Text = "CiWong." + txt_db.Text + ".Entities";
  // BindTables();
  }
  }

  #region DB

  public DataTable GetTable(string sql)
  {
  conn = string.Format(connStr, txt_server.Text, txt_db.Text, txt_uid.Text, txt_pwd.Text);
  DataSet ds = MySqlHelper.ExecuteDataset(conn, sql);
  return ds.Tables[0];
  }

  public void ExecuteSql(string sql)
  {
  MySqlHelper.ExecuteNonQuery(conn, sql);
  }

  #endregion

  #region select

  private void SelectAll(StringBuilder Sb, DataTable dt, int count, string tablename, string proname)
  {
  var cb3list = Request["cb3"];
  if (string.IsNullOrEmpty(cb3list))
  {
  Page.RegisterStartupScript("alert", "<script>alert('请选择要查询的列!')</script>");
  return;
  }
  string[] arraycb3 = new string[] { };
  arraycb3 = cb3list.Split(',');

  Sb.Append("CREATE OR REPLACE Procedure pro_" + proname + "_" + tablename);
  Sb.Append("\n(\n");
  //
  for (int i = 0; i < count; i++)
  {
  var fliedname = dt.Rows[i]["column_name"].ToString();
  var fliedtype = dt.Rows[i]["data_type"].ToString();
  var fliedlength = 0; // dt.Rows[i]["data_length"].ToString();
  //显示选中

  #region

  if (arraycb3 != null && arraycb3.Count() > 0)
  {
  for (int j = 0; j < arraycb3.Count(); j++)
  {
  if (fliedname == arraycb3[j].ToString())
  {
  Sb.Append(" _" + fliedname + " out " + fliedtype + "(" + fliedlength + ")");
  if (j != arraycb3.Count() - 1)
  {
  Sb.Append(",\n");
  }
  }
  }
  }

  #endregion
  }
  Sb.Append("\n)\n"