• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DataConnection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DataConnection的典型用法代码示例。如果您正苦于以下问题:C# DataConnection类的具体用法?C# DataConnection怎么用?C# DataConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataConnection类属于命名空间,在下文中一共展示了DataConnection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetPackageList

 public List<PackageDescriptor> GetPackageList(Guid InstallationId, string Culture)
 {
     using (DataConnection connection = new DataConnection())
     {
         return (
             from package in connection.Get<Package>().AsEnumerable()
             join media in connection.Get<IMediaFile>() on package.PackageFile equals media.KeyPath
             select new PackageDescriptor()
             {
                 Id = package.PackageId,
                 Name = package.Name,
                 GroupName = package.GroupName,
                 PackageVersion = package.PackageVersion,
                 MinCompositeVersionSupported = package.MinCompositeVersionSupported,
                 MaxCompositeVersionSupported = package.MaxCompositeVersionSupported,
                 Author = package.Author,
                 Description = package.Description,
                 TechicalDetails = package.TechnicalDetails,
                 EulaId = package.EULA,
                 ReadMoreUrl = package.ReadMoreUrl,
                 IsFree = true,
                 PackageFileDownloadUrl = new Uri(Context.Request.Url, UrlUtils.ResolvePublicUrl("Renderers/ShowMedia.ashx?id=" + media.Id)).OriginalString
             }
         ).ToList();
     }
 }
开发者ID:JustAndrei,项目名称:C1-Packages,代码行数:26,代码来源:Packages.cs


示例2: GetColumns

        protected override List<ColumnInfo> GetColumns(DataConnection dataConnection)
        {
            var sql = @"
                SELECT
                    TABSCHEMA,
                    TABNAME,
                    COLNAME,
                    LENGTH,
                    SCALE,
                    NULLS,
                    IDENTITY,
                    COLNO,
                    TYPENAME,
                    REMARKS
                FROM
                    SYSCAT.COLUMNS
                WHERE
                    " + GetSchemaFilter("TABSCHEMA");

            return _columns = dataConnection.Query(
                rd => new ColumnInfo
                {
                    TableID     = dataConnection.Connection.Database + "." + rd.GetString(0) + "." + rd.GetString(1),
                    Name        = rd.ToString(2),
                    Length      = Converter.ChangeTypeTo<long>(rd[3]),
                    Scale       = Converter.ChangeTypeTo<int> (rd[4]),
                    IsNullable  = rd.ToString(5) == "Y",
                    IsIdentity  = rd.ToString(6) == "Y",
                    Ordinal     = Converter.ChangeTypeTo<int>(rd[7]),
                    DataType    = rd.ToString(8),
                    Description = rd.ToString(9),
                },
                sql).ToList();
        }
开发者ID:jack128,项目名称:linq2db,代码行数:34,代码来源:DB2LUWSchemaProvider.cs


示例3: GetForeignKeys

        protected override List<ForeingKeyInfo> GetForeignKeys(DataConnection dataConnection)
        {
            const string baseSql = @"
                SELECT
                    o.name                           as Name,
                    c.tableid                        as ThisTableID,
                    r.reftabid                       as OtherTableID,
                    COL_NAME(c.tableid,  r.fokey{0})   as ThisColumn,
                    COL_NAME(r.reftabid, r.refkey{0})  as OtherColumn,
                    {0}                              as Ordinal
                FROM
                    sysreferences r
                        JOIN sysconstraints c ON r.constrid = c.constrid
                            JOIN sysobjects o  ON c.constrid = o.id
                            JOIN sysobjects o3 ON c.tableid  = o3.id
                        LEFT JOIN sysobjects o2 ON r.reftabid = o2.id
                        JOIN sysreferences r2 ON r.constrid = r2.constrid
                            LEFT JOIN sysindexes i ON r2.indexid = i.indid AND r2.reftabid = i.id
                WHERE
                    c.status = 64";

            string sql = null;

            for (var i = 1; i <= 16; i++)
            {
                if (sql != null)
                    sql += "\nUNION ALL";

                sql += string.Format(baseSql, i);
            }

            sql = "SELECT * FROM (" + sql + ") as t WHERE ThisColumn IS NOT NULL";

            return dataConnection.Query<ForeingKeyInfo>(sql).ToList();
        }
开发者ID:jogibear9988,项目名称:linq2db,代码行数:35,代码来源:SybaseSchemaProvider.cs


示例4: GetForeignKeys

 protected override List<ForeingKeyInfo> GetForeignKeys(DataConnection dataConnection)
 {
     return dataConnection.Query<ForeingKeyInfo>(@"
         SELECT
             rc.CONSTRAINT_NAME                                             as Name,
             fk.TABLE_CATALOG + '.' + fk.TABLE_SCHEMA + '.' + fk.TABLE_NAME as ThisTableID,
             fk.COLUMN_NAME                                                 as ThisColumn,
             pk.TABLE_CATALOG + '.' + pk.TABLE_SCHEMA + '.' + pk.TABLE_NAME as OtherTableID,
             pk.COLUMN_NAME                                                 as OtherColumn,
             pk.ORDINAL_POSITION                                            as Ordinal
         FROM
             INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc
             JOIN
                 INFORMATION_SCHEMA.KEY_COLUMN_USAGE fk
             ON
                 fk.CONSTRAINT_CATALOG = rc.CONSTRAINT_CATALOG AND
                 fk.CONSTRAINT_SCHEMA  = rc.CONSTRAINT_SCHEMA  AND
                 fk.CONSTRAINT_NAME    = rc.CONSTRAINT_NAME
             JOIN
                 INFORMATION_SCHEMA.KEY_COLUMN_USAGE pk
             ON
                 pk.CONSTRAINT_CATALOG = rc.UNIQUE_CONSTRAINT_CATALOG AND
                 pk.CONSTRAINT_SCHEMA  = rc.UNIQUE_CONSTRAINT_SCHEMA  AND
                 pk.CONSTRAINT_NAME    = rc.UNIQUE_CONSTRAINT_NAME
         WHERE
             fk.ORDINAL_POSITION = pk.ORDINAL_POSITION
         ORDER BY
             ThisTableID,
             Ordinal")
         .ToList();
 }
开发者ID:jjchiw,项目名称:linq2db,代码行数:31,代码来源:SqlServerSchemaProvider.cs


示例5: GetPrimaryKeys

		protected override List<PrimaryKeyInfo> GetPrimaryKeys(DataConnection dataConnection)
		{
			var dbConnection = (DbConnection)dataConnection.Connection;
			var pks          = dbConnection.GetSchema("IndexColumns");
			var idxs         = dbConnection.GetSchema("Indexes");

			return
			(
				from pk  in pks. AsEnumerable()
				join idx in idxs.AsEnumerable()
					on
						pk. Field<string>("INDEX_CATALOG") + "." +
						pk. Field<string>("INDEX_SCHEMA")  + "." +
						pk. Field<string>("INDEX_NAME")    + "." +
						pk. Field<string>("TABLE_NAME")
					equals
						idx.Field<string>("INDEX_CATALOG") + "." +
						idx.Field<string>("INDEX_SCHEMA")  + "." +
						idx.Field<string>("INDEX_NAME")    + "." +
						idx.Field<string>("TABLE_NAME")
				where idx.Field<bool>("PRIMARY")
				select new PrimaryKeyInfo
				{
					TableID        = pk.Field<string>("INDEX_SCHEMA") + ".." + pk.Field<string>("TABLE_NAME"),
					PrimaryKeyName = pk.Field<string>("INDEX_NAME"),
					ColumnName     = pk.Field<string>("COLUMN_NAME"),
					Ordinal        = pk.Field<int>   ("ORDINAL_POSITION"),
				}
			).ToList();
		}
开发者ID:donners77,项目名称:linq2db,代码行数:30,代码来源:MySqlSchemaProvider.cs


示例6: Pref

 public static string Pref(string prefName)
 {
     string command="SELECT ValueString FROM preference WHERE PrefName='"+POut.String(prefName)+"'";
     DataConnection dcon=new DataConnection();
     DataTable table=dcon.GetTable(command);
     return table.Rows[0][0].ToString();
 }
开发者ID:nampn,项目名称:ODental,代码行数:7,代码来源:GetData.cs


示例7: Page_Load

	protected void Page_Load(object sender, EventArgs e)
	{
		var reportId = Guid.Parse(this.Request["id"].ToString());
		var reportType = this.Request["type"].ToString();
		var pageUrl = string.Empty;
		using (DataConnection con = new DataConnection())
		{
			var report = con.Get<Composite.Forms.JotFormReport>().Where(r => r.Id == reportId).SingleOrDefault();
			if (report != null)
			{
				switch (reportType)
				{
					case "grid": pageUrl = report.GridReportURL; break;
					case "table": pageUrl = report.TableReportURL; break;
					case "visual": pageUrl = report.VisualReportURL; break;
					case "excel": pageUrl = report.ExcelReportURL; break;
					case "csv": pageUrl = report.CsvReportURL; break;
					default: break;
				}

			}
		}
		if (!string.IsNullOrWhiteSpace(pageUrl))
		{
			lPrintFrame.Text = string.Format(@"<iframe src=""{0}"" frameborder=""0"" style=""width:100%; height:100%; min-height:450px; border:none;"" ></iframe>", pageUrl);
		}
		else
		{
			lPrintFrame.Text = "<div style='padding: 20px'><h2>Report is not available</h2><p>The URL for this report has not been specified. To remedy this, edit this report and specify the JotForm Report URL.</p></div>";
		}
	}
开发者ID:JustAndrei,项目名称:C1-Packages,代码行数:31,代码来源:Report.aspx.cs


示例8: Render

            protected override void Render(HtmlTextWriter writer)
            {
                string description = Page.Header.Description;

                if (string.IsNullOrWhiteSpace(description) && SiteMap.CurrentNode != null)
                {
                    description = SiteMap.CurrentNode.Description;
                }

                if (string.IsNullOrWhiteSpace(description))
                {
                    using (DataConnection connection = new DataConnection())
                    {
                        description = connection.SitemapNavigator.CurrentPageNode.Description;
                    }
                }

                if (string.IsNullOrWhiteSpace(description)) return;

                if (_element != null)
                {
                    _element.Add(description);
                    string commonNs = string.Format(" xmlns=\"{0}\"", Namespaces.Xhtml );
                    string raw = _element.ToString().Replace(commonNs, "");
                    writer.Write(raw);
                }
                else
                {
                    writer.WriteEncodedText(description);
                }
            }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:31,代码来源:MetaDescriptionValueFunction.cs


示例9: GetDataTypes

		protected override List<DataTypeInfo> GetDataTypes(DataConnection dataConnection)
		{
			var dts = base.GetDataTypes(dataConnection);

			if (dts.All(dt => dt.ProviderDbType != 128))
			{
				dts.Add(new DataTypeInfo
				{
					TypeName         = "image",
					DataType         = typeof(byte[]).FullName,
					CreateFormat     = "image({0})",
					CreateParameters = "length",
					ProviderDbType   = 128
				});
			}

			if (dts.All(dt => dt.ProviderDbType != 130))
			{
				dts.Add(new DataTypeInfo
				{
					TypeName         = "text",
					DataType         = typeof(string).FullName,
					CreateFormat     = "text({0})",
					CreateParameters = "length",
					ProviderDbType   = 130
				});
			}

			return dts;
		}
开发者ID:donners77,项目名称:linq2db,代码行数:30,代码来源:AccessSchemaProvider.cs


示例10: loadvisits

        public void loadvisits(int studentID, DateTime minDate, DateTime maxDate)
        {
            min = minDate;
            max = maxDate;
            ID = studentID;
            //clears the list box to enter new information
            listBoxEditVisit.Items.Clear();
            //TAB THIS
            listBoxEditVisit.Items.Add("DATE".PadRight(15) + "\t" + "FIRST NAME".PadRight(30) + "\t" + "LAST NAME".PadRight(30) + "\t" + "ID".PadRight(12)+ "\t" + "TIME IN".PadRight(10)+"\t" + "TIME OUT".PadRight(10) + "\t" + "METHOD".PadRight(20) + "\t" + "TUTOR'S FIRST NAME".PadRight(30) + "TUTOR'S LAST NAME".PadRight(30)+ "\t" + "SUBJECT" + "\t" + "CATALOG" + "\t" + "SECTION");
            //creates new dataconnection
            DataConnection conn = new DataConnection();
            SqlDataReader rd;

            conn.Open();

                //gets visits request
                //just added STUDENT.FIRSTNAME, STUDENT.LASTNAME, STUDENT TABLE
                rd = conn.joinQuery("SELECT VISIT.CLARION_ID, VISIT.DATE, VISIT.TIME_IN, VISIT.TIME_OUT, STUDENT.FIRSTNAME, STUDENT.LASTNAME, VISIT.METHOD, TUTOR.TUTOR_ID, SUBJECT, CATALOG, S_TUTOR.FIRSTNAME AS TUTORFIRSTNAME, S_TUTOR.LASTNAME AS TUTORLASTNAME, SECTION FROM VISIT INNER JOIN student on visit.clarion_id = student.clarion_id LEFT JOIN TUTOR ON VISIT.TUTOR_ID = TUTOR.TUTOR_ID LEFT JOIN STUDENT S_TUTOR ON TUTOR.CLARION_ID = S_TUTOR.CLARION_ID WHERE visit.DATE<='" + maxDate + "' AND visit.DATE>='" + minDate + (studentID == 0 ? "'":"' AND VISIT.CLARION_ID = '" + studentID + "'") + " ORDER BY DATE, TIME_IN");

            if (rd.HasRows)
            {

                while (rd.Read())
                {
                    DateTime thedate = DateTime.Parse(rd["DATE"].ToString());
                    string TIMEOUT = rd["TIME_OUT"].ToString().PadRight(10);
                    if (TIMEOUT.Replace(" ","").Length !=8)
                        TIMEOUT = " ".PadRight(18);
                    listBoxEditVisit.Items.Add(thedate.ToString("d").PadRight(15) + "\t" + rd["FIRSTNAME"].ToString().PadRight(30) + "\t" + rd["LASTNAME"].ToString().PadRight(30) + "\t" + (int.Parse(rd["CLARION_ID"].ToString())).ToString("D8").PadRight(12) + "\t" + rd["TIME_IN"].ToString().PadRight(10) + "\t" + TIMEOUT.PadRight(10) + "\t" + rd["METHOD"].ToString().PadRight(20) + "\t" + rd["TUTORFIRSTNAME"].ToString().PadRight(30) + " " + rd["TUTORLASTNAME"].ToString().PadRight(30) + "\t" + rd["SUBJECT"].ToString().PadRight(5) + "\t" + ((rd["CATALOG"]).ToString()).PadRight(5) + "\t" + ((rd["SECTION"]).ToString()).PadRight(4));
                }
            }
            rd.Close();
            //closes connection
            conn.Close();

            if (studentID == 0)
            {
                conn.Open();

                //gets visits request
                //just added STUDENT.FIRSTNAME, STUDENT.LASTNAME, STUDENT TABLE
               // rd = conn.joinQuery("SELECT VISIT.CLARION_ID, VISIT.DATE, VISIT.TIME_IN, VISIT.TIME_OUT, STUDENT.FIRSTNAME, STUDENT.LASTNAME, VISIT.METHOD, TUTOR.TUTOR_ID, SUBJECT, CATALOG, S_TUTOR.FIRSTNAME AS TUTORFIRSTNAME, S_TUTOR.LASTNAME AS TUTORLASTNAME, SECTION FROM VISIT INNER JOIN student on visit.clarion_id = student.clarion_id LEFT JOIN TUTOR ON VISIT.TUTOR_ID = TUTOR.TUTOR_ID LEFT JOIN STUDENT S_TUTOR ON TUTOR.CLARION_ID = S_TUTOR.CLARION_ID WHERE visit.DATE<='" + maxDate + "' AND visit.DATE>='" + minDate + (studentID == 0 ? "'" : "' AND VISIT.CLARION_ID = '" + studentID + "'") + " ORDER BY DATE, TIME_IN");
                rd = conn.joinQuery("select tutor_hour.tutor_id, tutor_hour.date, tutor_hour.time_out ,tutor_hour.time_difference, tutor_hour.time_in, student.lastname, student.firstname from tutor_hour inner join tutor on tutor_hour.tutor_id = tutor.tutor_id inner join student on tutor.clarion_id = student.clarion_id where tutor_hour.DATE<='" + maxDate + "' AND tutor_hour.DATE>='" + minDate+"' ");

                if (rd.HasRows)
                {
                    while (rd.Read())
                    {
                        DateTime thedate = DateTime.Parse(rd["DATE"].ToString());
                        string TIMEOUT = rd["TIME_OUT"].ToString().PadRight(10);
                        if (TIMEOUT.Replace(" ", "").Length != 8)
                            TIMEOUT = " ".PadRight(18);
                        listBoxEditVisit.Items.Add(thedate.ToString("d").PadRight(15) + "\t" + rd["FIRSTNAME"].ToString().PadRight(30) + "\t" + rd["LASTNAME"].ToString().PadRight(30) + "\t" + ("TUT" + int.Parse(rd["tutor_ID"].ToString()).ToString("D4").PadRight(10)) + "\t" + rd["TIME_IN"].ToString().PadRight(10) + "\t" + rd["TIME_OUT"].ToString().PadRight(10) + "\t" + "TUTOR");
                    }
                }
                rd.Close();
                //closes connection
                conn.Close();
            }
        }
开发者ID:pelolep,项目名称:CIS411,代码行数:60,代码来源:frmEditList.cs


示例11: GetCustomEditorSettings

        /// <summary>
        /// Returns a relative path a to a custom funtion call editor for the specified function.
        /// </summary>
        /// <param name="functionName">The function name</param>
        /// <returns>A relative path to a custom call editor, or <value>null</value> if no custom editor was defined.</returns>
        public static FunctionCallEditorSettings GetCustomEditorSettings(string functionName)
        {
            var settings = _customEditorSettings[functionName];
            if (settings != null)
            {
                return settings;
            }

            using (var c = new DataConnection())
            {
                var mapping = c.Get<ICustomFunctionCallEditorMapping>().FirstOrDefault(e => e.FunctionName == functionName);

                if (mapping != null)
                {
                    return new FunctionCallEditorSettings
                    {
                        Url = UrlUtils.ResolvePublicUrl(mapping.CustomEditorPath),
                        Width = mapping.Width,
                        Height = mapping.Height
                    };
                }
            }

            return null;
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:30,代码来源:FunctionCallEditorManager.cs


示例12: GetPrimaryKeys

		protected override List<PrimaryKeyInfo> GetPrimaryKeys(DataConnection dataConnection)
		{
			return _primaryKeys = dataConnection.Query(
				rd => new PrimaryKeyInfo
				{
					TableID        = dataConnection.Connection.Database + "." + rd.ToString(0) + "." + rd.ToString(1),
					PrimaryKeyName = rd.ToString(2),
					ColumnName     = rd.ToString(3),
					Ordinal        = Converter.ChangeTypeTo<int>(rd[4])
				},@"
					SELECT
						col.TBCREATOR,
						col.TBNAME,
						idx.NAME,
						col.NAME,
						col.KEYSEQ
					FROM
						SYSIBM.SYSCOLUMNS col
							JOIN SYSIBM.SYSINDEXES idx ON
								col.TBCREATOR = idx.TBCREATOR AND
								col.TBNAME    = idx.TBNAME
					WHERE
						col.KEYSEQ > 0 AND idx.UNIQUERULE = 'P' AND " + GetSchemaFilter("col.TBCREATOR") + @"
					ORDER BY
						col.TBCREATOR, col.TBNAME, col.KEYSEQ")
				.ToList();
		}
开发者ID:Convey-Compliance,项目名称:linq2db,代码行数:27,代码来源:DB2zOSSchemaProvider.cs


示例13: GetDataTypes

		protected override List<DataTypeInfo> GetDataTypes(DataConnection dataConnection)
		{
			return new List<DataTypeInfo>
			{
				new DataTypeInfo { TypeName = "XML",                       CreateParameters = null,               DataType = "System.String"   },
				new DataTypeInfo { TypeName = "DECFLOAT",                  CreateParameters = "PRECISION",        DataType = "System.Decimal"  },
				new DataTypeInfo { TypeName = "DBCLOB",                    CreateParameters = "LENGTH",           DataType = "System.String"   },
				new DataTypeInfo { TypeName = "CLOB",                      CreateParameters = "LENGTH",           DataType = "System.String"   },
				new DataTypeInfo { TypeName = "BLOB",                      CreateParameters = "LENGTH",           DataType = "System.Byte[]"   },
				new DataTypeInfo { TypeName = "LONG VARGRAPHIC",           CreateParameters = null,               DataType = "System.String"   },
				new DataTypeInfo { TypeName = "VARGRAPHIC",                CreateParameters = "LENGTH",           DataType = "System.String"   },
				new DataTypeInfo { TypeName = "GRAPHIC",                   CreateParameters = "LENGTH",           DataType = "System.String"   },
				new DataTypeInfo { TypeName = "BIGINT",                    CreateParameters = null,               DataType = "System.Int64"    },
				new DataTypeInfo { TypeName = "LONG VARCHAR FOR BIT DATA", CreateParameters = null,               DataType = "System.Byte[]"   },
				new DataTypeInfo { TypeName = "VARCHAR () FOR BIT DATA",   CreateParameters = "LENGTH",           DataType = "System.Byte[]"   },
				new DataTypeInfo { TypeName = "VARBIN",                    CreateParameters = "LENGTH",           DataType = "System.Byte[]"   },
				new DataTypeInfo { TypeName = "BINARY",                    CreateParameters = "LENGTH",           DataType = "System.Byte[]"   },
				new DataTypeInfo { TypeName = "CHAR () FOR BIT DATA",      CreateParameters = "LENGTH",           DataType = "System.Byte[]"   },
				new DataTypeInfo { TypeName = "LONG VARCHAR",              CreateParameters = "LENGTH",           DataType = "System.String"   },
				new DataTypeInfo { TypeName = "CHARACTER",                 CreateParameters = "LENGTH",           DataType = "System.String"   },
				new DataTypeInfo { TypeName = "CHAR",                      CreateParameters = "LENGTH",           DataType = "System.String"   },
				new DataTypeInfo { TypeName = "DECIMAL",                   CreateParameters = "PRECISION,SCALE",  DataType = "System.Decimal"  },
				new DataTypeInfo { TypeName = "INTEGER",                   CreateParameters = null,               DataType = "System.Int32"    },
				new DataTypeInfo { TypeName = "SMALLINT",                  CreateParameters = null,               DataType = "System.Int16"    },
				new DataTypeInfo { TypeName = "REAL",                      CreateParameters = null,               DataType = "System.Single"   },
				new DataTypeInfo { TypeName = "DOUBLE",                    CreateParameters = null,               DataType = "System.Double"   },
				new DataTypeInfo { TypeName = "VARCHAR",                   CreateParameters = "LENGTH",           DataType = "System.String"   },
				new DataTypeInfo { TypeName = "DATE",                      CreateParameters = null,               DataType = "System.DateTime" },
				new DataTypeInfo { TypeName = "TIME",                      CreateParameters = null,               DataType = "System.TimeSpan" },
				new DataTypeInfo { TypeName = "TIMESTAMP",                 CreateParameters = null,               DataType = "System.DateTime" },
				new DataTypeInfo { TypeName = "TIMESTMP",                  CreateParameters = null,               DataType = "System.DateTime" },
				new DataTypeInfo { TypeName = "ROWID",                     CreateParameters = "LENGTH",           DataType = "System.Byte[]"   },
			};
		}
开发者ID:Convey-Compliance,项目名称:linq2db,代码行数:34,代码来源:DB2zOSSchemaProvider.cs


示例14: GetColumns

        protected override List<ColumnInfo> GetColumns(DataConnection dataConnection)
        {
            var sql = @"
                SELECT
                    TBCREATOR,
                    TBNAME,
                    NAME,
                    LENGTH,
                    SCALE,
                    NULLS,
                    CASE WHEN DEFAULT IN ('I', 'J') THEN 'Y' ELSE 'N' END,
                    COLNO,
                    COLTYPE,
                    REMARKS
                FROM
                    SYSIBM.SYSCOLUMNS
                WHERE
                    " + GetSchemaFilter("TBCREATOR");

            return dataConnection.Query(
                rd => new ColumnInfo
                {
                    TableID     = dataConnection.Connection.Database + "." + rd.GetString(0) + "." + rd.GetString(1),
                    Name        = rd.ToString(2),
                    Length      = Converter.ChangeTypeTo<int>(rd[3]),
                    Scale       = Converter.ChangeTypeTo<int>(rd[4]),
                    IsNullable  = rd.ToString(5) == "Y",
                    IsIdentity  = rd.ToString(6) == "Y",
                    Ordinal     = Converter.ChangeTypeTo<int>(rd[7]),
                    DataType    = rd.ToString(8),
                    Description = rd.ToString(9),
                },
                sql).ToList();
        }
开发者ID:nectide,项目名称:linq2db,代码行数:34,代码来源:DB2zOSSchemaProvider.cs


示例15: GetPrimaryKeys

		protected override List<PrimaryKeyInfo> GetPrimaryKeys(DataConnection dataConnection)
		{
			return dataConnection.Query(rd =>
			{
				var constraint = rd.IsDBNull(3) ? null : rd.GetString(3);

				if (constraint != "PRIMARY KEY")
					return null;

				var schema     = rd.GetString(0);
				var tableName  = rd.GetString(1);
				var indexName  = rd.GetString(2);
				var columnName = rd.GetString(4);
				var position   = rd.GetInt32(5);

				return new PrimaryKeyInfo
				{
					TableID = String.Concat(schema, '.', tableName),
					ColumnName = columnName,
					Ordinal = position,
					PrimaryKeyName = indexName
				};
			}, @"
				SELECT
					SCHEMA_NAME,
					TABLE_NAME,
					INDEX_NAME,
					CONSTRAINT,
					COLUMN_NAME,
					POSITION
				FROM INDEX_COLUMNS")
				.Where(x => x != null).ToList();
		}
开发者ID:ronnyek,项目名称:linq2db,代码行数:33,代码来源:SapHanaOdbcSchemaProvider.cs


示例16: GetTables

		protected override List<TableInfo> GetTables(DataConnection dataConnection)
		{
			CurrenSchema = dataConnection.Execute<string>("select current_schema from sysibm.sysdummy1");

			var tables = ((DbConnection)dataConnection.Connection).GetSchema("Tables");

			return
			(
				from t in tables.AsEnumerable()
				where
					new[] { "TABLE", "VIEW" }.Contains(t.Field<string>("TABLE_TYPE"))
				let catalog = dataConnection.Connection.Database
				let schema  = t.Field<string>("TABLE_SCHEMA")
				let name    = t.Field<string>("TABLE_NAME")
				where IncludedSchemas.Length != 0 || ExcludedSchemas.Length != 0 || schema == CurrenSchema
				select new TableInfo
				{
					TableID         = catalog + '.' + schema + '.' + name,
					CatalogName     = catalog,
					SchemaName      = schema,
					TableName       = name,
					IsDefaultSchema = schema.IsNullOrEmpty(),
					IsView          = t.Field<string>("TABLE_TYPE") == "VIEW",
					Description     = t.Field<string>("REMARKS"),
				}
			).ToList();
		}
开发者ID:donners77,项目名称:linq2db,代码行数:27,代码来源:DB2LUWSchemaProvider.cs


示例17: DataConnectionWrapper

        /// <summary>
        /// Constructor stores given connection into private variable
        /// </summary>
        /// <param name="connection"></param>
        public DataConnectionWrapper(DataConnection connection)
        {
            if (connection == null)
                throw new ArgumentNullException("connection");

            connectionRef = connection;
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:11,代码来源:DataConnectionWrapper.cs


示例18: GetPrimaryKeys

		protected override List<PrimaryKeyInfo> GetPrimaryKeys(DataConnection dataConnection)
		{
			return
			(
				from pk in dataConnection.Query(
					rd => new
					{
						id   = dataConnection.Connection.Database + "." + rd.ToString(0) + "." + rd.ToString(1),
						name = rd.ToString(2),
						cols = rd.ToString(3).Split('+').Skip(1).ToArray(),
					},@"
					SELECT
						TABSCHEMA,
						TABNAME,
						INDNAME,
						COLNAMES
					FROM
						SYSCAT.INDEXES
					WHERE
						UNIQUERULE = 'P' AND " + GetSchemaFilter("TABSCHEMA"))
				from col in pk.cols.Select((c,i) => new { c, i })
				select new PrimaryKeyInfo
				{
					TableID        = pk.id,
					PrimaryKeyName = pk.name,
					ColumnName     = col.c,
					Ordinal        = col.i
				}
			).ToList();
		}
开发者ID:donners77,项目名称:linq2db,代码行数:30,代码来源:DB2LUWSchemaProvider.cs


示例19: RetainedEarningsAuto

 ///<Summary>Gets sum of all income-expenses for all previous years. asOfDate could be any date</Summary>
 public static float RetainedEarningsAuto(object asOfDateObj)
 {
     DateTime asOfDate;
     if(asOfDateObj.GetType()==typeof(string)) {
         asOfDate=PIn.Date(asOfDateObj.ToString());
     }
     else if(asOfDateObj.GetType()==typeof(DateTime)) {
         asOfDate=(DateTime)asOfDateObj;
     }
     else {
         return 0;
     }
     DateTime firstOfYear=new DateTime(asOfDate.Year,1,1);
     string command="SELECT SUM(CreditAmt), SUM(DebitAmt), AcctType "
     +"FROM journalentry,account "
     +"WHERE journalentry.AccountNum=account.AccountNum "
     +"AND DateDisplayed < "+POut.Date(firstOfYear)
     +" GROUP BY AcctType";
     DataConnection dcon=new DataConnection();
     DataTable table=dcon.GetTable(command);
     float retVal=0;
     for(int i=0;i<table.Rows.Count;i++) {
         if(table.Rows[i][2].ToString()=="3"//income
             || table.Rows[i][2].ToString()=="4")//expense
         {
             retVal+=PIn.Float(table.Rows[i][0].ToString());//add credit
             retVal-=PIn.Float(table.Rows[i][1].ToString());//subtract debit
             //if it's an expense, we are subtracting (income-expense), but the signs cancel.
         }
     }
     return retVal;
 }
开发者ID:nampn,项目名称:ODental,代码行数:33,代码来源:GetData.cs


示例20: GetColumns

        protected override List<ColumnInfo> GetColumns(DataConnection dataConnection)
        {
            var sql = @"
                    SELECT
                        table_catalog || '.' || table_schema || '.' || table_name           as TableID,
                        column_name                                                         as Name,
                        is_nullable = 'YES'                                                 as IsNullable,
                        ordinal_position                                                    as Ordinal,
                        data_type                                                           as DataType,
                        character_maximum_length                                            as Length,
                        COALESCE(numeric_precision, datetime_precision, interval_precision) as Precision,
                        numeric_scale                                                       as Scale,
                        is_identity = 'YES' OR COALESCE(column_default ~* 'nextval', false) as IsIdentity,
                        is_generated <> 'NEVER'                                             as SkipOnInsert,
                        is_updatable = 'NO'                                                 as SkipOnUpdate
                    FROM
                        information_schema.columns";

            if (ExcludedSchemas.Length == 0 || IncludedSchemas.Length == 0)
                sql += @"
                    WHERE
                        table_schema NOT IN ('pg_catalog','information_schema')";

            return dataConnection.Query<ColumnInfo>(sql).ToList();
        }
开发者ID:henleygao,项目名称:linq2db,代码行数:25,代码来源:PostgreSQLSchemaProvider.cs



注:本文中的DataConnection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DataContainer类代码示例发布时间:2022-05-24
下一篇:
C# DataColumn类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap