/// <summary> /// /// </summary> /// <returns></returns> private System.Data.DataView GetColumnsType() { //Fan.iData.DB idb; //数据库连接类,改成自己的数据库连接 //if (_ConnName == "") // idb = new Fan.iData.DB(); //else // idb = new Fan.iData.DB(_ConnName); string sql = @" select a.[name],a.[length] ,case when a.xusertype in (127,104,106,62,56,60,108,59,52,122,48) then 0 when a.xusertype in (175,35,167) then 1 when a.xusertype in (239,99,231) then 2 when a.xusertype in (61,58) then 3 when a.xusertype in (165,173,36) then 4 when a.xusertype in (34,98,241,189,256) then -1 else -1 end [xtype] from syscolumns a where object_id('" + _tableName + @"')=a.[id] order by a.colid "; //return idb.GetDataView(sql); return(DbFactoryProvider.GetProvider(_ConnName).Fill(sql).DefaultView); #region 0=数值型;1=字符型;2=Unicode字符型;3=日期型;4=二进制数据;-1=不支持的类型 //0=数值型;1=字符型;2=Unicode字符型;3=日期型;4=二进制数据;-1=不支持的类型 //name xtype //bigint 127 //binary 173 //bit 104 //char 175 //datetime 61 //decimal 106 //float 62 //image 34 //int 56 //money 60 //nchar 239 //ntext 99 //numeric 108 //nvarchar 231 //real 59 //smalldatetime 58 //smallint 52 //smallmoney 122 //sql_variant 98 //sysname 231 //text 35 //timestamp 189 //tinyint 48 //uniqueidentifier 36 //varbinary 165 //varchar 167 //xml 241 #endregion }
/// <summary> /// DbProviderFactory实例 /// </summary> public virtual DbProviderFactory GetInstance() { return(_dbProviderFactory ?? (_dbProviderFactory = DbFactoryProvider.GetProvider().GetInstance())); }