zoukankan      html  css  js  c++  java
  • SQL转换

      private void Page_Load(object sender, System.EventArgs e)
      {
       String Sql = "INSERT INTO ssUser (UID, UserID, UserPwd) VALUES ('1', '2', '2')";
       Sql = Sql.Substring(Sql.IndexOf("INTO") + 4);
       string table =  Sql.Substring(0,Sql.IndexOf("("));
       string psv =  Sql.Substring(Sql.IndexOf("VALUE"));

       Hashtable ht = new Hashtable();

       string[] Psn = SubString(Sql,"\\(","\\)").Split(',');
       string[] Psv = SubString(psv,"\\(","\\)").Split(',');
       this.Response.Write(Psn[1] + ":" +Psv[1]);

     


      }

      /// <summary>
      /// 返回字符串的字串
      /// </summary>
      /// <param name="s1">被处理的字符串</param>
      /// <param name="startSign">开始标记</param>
      /// <param name="endSign">结束标记</param>
      /// <returns>返回字串</returns>
      private string SubString(string s1,string startSign,string endSign)
      {
       return System.Text.RegularExpressions.Regex.Match(s1, startSign + "(.*?)" + endSign).Result("$1");
      }


    OleDbConnection cnn = new ...;
    OleDbDataAdapter da = new ....("select * from table1",cnn);
    da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
    DataTable dt = new ...
    da.Fill(dt);
    //通过PrimaryKey属性取主键
    Response.Write(dt.PrimaryKey[0].ColumnName);

  • 相关阅读:
    设置内存管理
    Kill Session
    设置In_Memery
    查询无效对象 及 重新编译
    Oracle 硬解析查询
    设置Oracle 12C OEM 端口
    创建Mysql 序列
    compress 表设置及索引设置
    闪回表
    ECS Samples概述
  • 原文地址:https://www.cnblogs.com/ejiyuan/p/947211.html
Copyright © 2011-2022 走看看