Exemplo n.º 1
0
        public Dictionary <string, string> GetOptionsFields(Guid id, string sql)
        {
            Dictionary <string, string> list = new Dictionary <string, string>();

            RoadFlow.Platform.DBConnection   bdbconn = new RoadFlow.Platform.DBConnection();
            RoadFlow.Data.Model.DBConnection dbconn  = bdbconn.Get(id);
            using (System.Data.IDbConnection conn = bdbconn.GetConnection(dbconn))
            {
                if (conn == null)
                {
                    return(list);
                }
                try
                {
                    conn.Open();
                }
                catch (Exception ex)
                {
                    System.Web.HttpContext.Current.Response.Write("连接数据库出错:" + ex.Message);
                    RoadFlow.Platform.Log.Add(ex);
                }
                List <System.Data.IDataParameter> parList     = new List <System.Data.IDataParameter>();
                System.Data.IDbDataAdapter        dataAdapter = bdbconn.GetDataAdapter(conn, dbconn.Type, sql, parList.ToArray());
                System.Data.DataSet ds = new System.Data.DataSet();
                dataAdapter.Fill(ds);
                foreach (System.Data.DataRow row in ds.Tables[0].Rows)
                {
                    list.Add(row[0].ToString(), row[1].ToString());
                }
                return(list);
            }
        }