社区
C#
帖子详情
请教DbParameter为何可以不实现接口IDbDataParameter中的属性
ufo20020427
2015-11-26 08:12:17
接口 IDbDataParameter 里面有Precision, Scale,Size 这三个属性,但是DbParameter为何可以不实现这几个属性?
(我自己也试过建个抽象类,继承于IDbDataParameter,如果不实现三述属性,编译器确实会报错的)
谢谢!
...全文
151
3
打赏
收藏
请教DbParameter为何可以不实现接口IDbDataParameter中的属性
接口 IDbDataParameter 里面有Precision, Scale,Size 这三个属性,但是DbParameter为何可以不实现这几个属性? (我自己也试过建个抽象类,继承于IDbDataParameter,如果不实现三述属性,编译器确实会报错的) 谢谢!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
江南小鱼
2015-11-27
打赏
举报
回复
显示实现的 你反编译看看源码
skyandcode
2015-11-27
打赏
举报
回复
你没注意到vs只给你看到protected和public类型的成员吗。
娃都会打酱油了
2015-11-26
打赏
举报
回复
显示实现了,vs里这样看不出来
开源Silverlight数据访问组件System.
Data
.Silverlight
1.概述 该组件提供类似ADO.NET编程
接口
,可以直接在Silverlight端访问Web端数据库。可以
实现
在Web端无需事先手工编写或自动创建任何程序代码和数据实体类的情况下, 便可在Silverlight端对Web端数据库进行增加、删除、修改、查询等数据操作。此外, 还支持访问数据库的存储过程(StoredProcdures)、视图(Views)、自定义函数(User Defined Functions)等。 2、使用前的准备 2.1组件Lib文件 该组件包含3个文件: System.
Data
.Silverlight.dll、 System.
Data
.Silverlight.Web.dll
Data
Handler.ashx 2.1.1System.
Data
.Silverlight.dll Silverlight端需引用的程序集,引用该程序集还需要引用关联的程序集,包含: System.ComponentModel.
Data
Annotations.dll System.Windows.Controls.
Data
.dll System.Windows.Controls.
Data
.Input.dll System.Windows.
Data
.dll System.Xml.Linq.dll 该程序集
中
定义了一套
Data
Set、
Data
Ta对象,作为数据通讯的数据格式,完全兼容ADO.NET
中
的
Data
Set、
Data
Table,两者之间可以通过XML互相转换,提供相应的转换方法。程序
中
还定义了一套
Db
Connection、
Db
Command对象,用于向Web端发起数据库操作命令,使用方式类似ADO.NET。 2.1.2 System.
Data
.Silverlight.Web.dll Web服务器端文件,需要把该程序集拷贝到网站Bin目录,无需引用。 2.1.3
Data
Handler.ashx Web服务器端的文件,需要把该文件拷贝到网站根目录。 2.2同步方式操作数据库示例 //创建一个数据连接
Db
Connection conn = new
Db
Connection("Server=192.168.0.7;
Data
Base=JitonClient;Uid=sa;Pwd=jiton;"); //创建一个数据命令
Db
CommandSyn cmd = new
Db
CommandSyn(); //设置命令的连接 cmd.Connection = conn; //设置SQL语句,可以是存储过程 cmd.CommandText = "SELECT [UserId],[UserName],[GroupId] FROM [Usertb] WHERE [GroupId]=@GroupId"; //设置命令类型,一般SQL语句是Text,存储过程是StoredProcedure cmd.CommandType =
Db
CommandType.Text; //设置执行类型 cmd.ExecuteType =
Db
ExecuteType.Reader; //添加一个参数,无参数可以不添加 cmd.
Parameter
s.Add(new
Db
Parameter
(
Db
Type.Int32, "@GroupId", 5)); //执行命令,得到结果
Db
CommandExecuteResult result = cmd.Execute(); if (!string.IsNullOrEmpty(result.ErrMsg))//首先判断ErrMsg是否有值,有表示执行过程发生错误 { MessageBox.Show("发生错误:" + result.ErrMsg); } else {
Data
Table dt = result.ReaderResult; //将数据显示在
Data
Grid
中
this.
data
Grid1.ItemsSource = dt.Rows; } 2.3异步方式操作数据库示例 //创建一个数据连接
Db
Connection conn = new
Db
Connection("
Data
Source=|
Data
Directory|CSmsPlatThird.
db
;Pooling=true;FailIfMissing=false"); //设置使用的数据访问程序集 conn.AssemblyName = "System.
Data
.SQLite"; //设置数据工厂,这里是SQLite的数据工厂 conn.
Db
ProviderFactory = "System.
Data
.SQLite.SQLiteFactory"; //创建一个数据命令
Db
CommandAsyn cmd = new
Db
CommandAsyn(); //设置命令的连接 cmd.Connection = conn; //设置SQL语句,可以是存储过程 cmd.CommandText = "SELECT [Id],[Content],[PlatFlag],[DateTime] FROM [T_Logger] WHERE [Id]>=@Id"; //设置命令类型,一般SQL语句是Text,存储过程是StoredProcedure cmd.CommandType =
Db
CommandType.Text; //设置执行类型 cmd.ExecuteType =
Db
ExecuteType.Reader; //添加一个参数,无参数可以不添加 cmd.
Parameter
s.Add(new
Db
Parameter
(
Db
Type.Int32, "@Id", 3)); //设置命令执行完毕的委托事件 cmd.ExecuteEnd += new EventHandler<
Db
CommandExecuteResult>(cmd_ExecuteEnd); //异步执行命令 cmd.Execute(); void cmd_ExecuteEnd(object sender,
Db
CommandExecuteResult e) { if (!string.IsNullOrEmpty(e.ErrMsg))//首先判断ErrMsg是否有值,有表示执行过程发生错误 { MessageBox.Show("发生错误:" + e.ErrMsg); } else {
Data
Table dt = e.ReaderResult; //将数据显示在
Data
Grid
中
this.
data
Grid1.ItemsSource = dt.Rows; } } 2.4对其它数据库的支持 该组件默认支持SQL Sserver,理论上也可支持其它数据库,只要数据库提供对应的ADO.NET
实现
接口
,已经测试过Access、SQLite。操作其它数据库时必须把对应的ADO.NET
实现
接口
的程序集拷贝到网站Bin目录下面,操作SQL Server无需该步骤。比如操作SQLite数据库,需要把SQLite的ADO.NET
实现
接口
程序集System.
Data
.SQLite.dll文件拷贝到网站Bin下面。此外还需指定
Db
Connection对象的AssemblyName、
Db
ProviderFactory
属性
的值。 //创建一个数据连接
Db
Connection conn = new
Db
Connection("
Data
Source=|
Data
Directory|CSmsPlatThird.
db
;Pooling=true;FailIfMissing=false"); //设置使用的数据访问程序集 conn.AssemblyName = "System.
Data
.SQLite"; //设置数据工厂,这里是SQLite的数据工厂 conn.
Db
ProviderFactory = "System.
Data
.SQLite.SQLiteFactory"; 其它操作步骤和操作SQL Server无差异,完整的示例代码见2.3
中
的示例。 2.5技术交流 有任何问题可以加入唯一指定的专用QQ群153079750进行反馈交流,也欢迎加入笔者的另一个Silverlight技术群175213051进行交流。
简单的ADO.net数据访问客户端
原文地址:https://github.com/andolove/
Data
感谢作者!很实用 简单的Ado.net数据访问客户端。 数据库访问入口 获取
I
Db
Client 在开始之前,先添加一个数据库访问入口。当然,也可以使用任何你喜欢的方式来创建
I
Db
Client(的
实现
类)实例。 public static class
Db
{ private static readonly Dictionary
I
Db
Client> KnownClients = new Dictionary
I
Db
Client>(); public static
I
Db
Client Northwind { get { return GetClient("Northwind", "server=.;
data
base=Northwind;trusted_connection=true;"); } } private static
I
Db
Client GetClient(string name, string connectionString) {
I
Db
Client client; if (KnownClients.TryGetValue(name, out client)) return client; lock (KnownClients) { if (KnownClients.TryGetValue(name, out client)) return client; // 创建
I
Db
Client的实例 client = new Sql
Db
Client(connectionString); KnownClients.Add(name, client); } return client; } } 现在,可以使用
Db
.Northwind来访问SQLServer的Northwind示例数据库了。 访问其他数据库 如果要访问MySql,可以用几行代码
实现
一个面向MySql的
I
Db
Client
实现
。下面以使用 MySql.
Data
.dll 作为MySql .net客户端提供器为例。 ///
/// Mysql数据库访问客户端。 ///
public class Mysql
Db
Client : Abstract
Db
Client { private readonly string _connectionString; ///
/// 使用指定的数据库类型和连接字符串初始化
的新实例。 ///
///
连接字符串。 public Mysql
Db
Client(string connectionString) { ArgAssert.NotNullOrEmptyOrWhitespace(connectionString, "connectionString"); _connectionString = connectionString; } ///
/// 获取当前实例所使用的数据库连接字符串。 ///
public override string ConnectionString { get { return _connectionString; } } ///
/// 获取当前实例所使用的
实例。 ///
protected override
Db
ProviderFactory Factory { get { return MySql.
Data
.MySqlClient.MySqlClientFactory.Instance; } } } 现在可以创建MySql的访问客户端了:
I
Db
Client client = new Mysql
Db
Client("server=.;
data
base=MySql
Db
;uid=user;pwd=password"); 类似的,可以创建访问Oracle,Sqlite或是其他数据库的客户端,只需要找到对应的
Db
ProviderFactory实例即可。 基本数据库操作 基础CRUD // 查询 string productName = (string)
Db
.Northwind.Scalar( "SELECT ProductName FROM Products WHERE ProductID=115");
Data
Table productTable =
Db
.Northwind.
Data
Table("SELECT * FROM Products"); // 更新 int affectedRows =
Db
.Northwind.Execute( "UPDATE Products SET ProductName='The Name' WHERE ProductID=115"); // 在没有命
中
一行的时候抛出异常 int expectedSize = 1;
Db
.Northwind.SizedExecute( expectedSize, "UPDATE Products SET ProductName='The Name' WHERE ProductID=115"); // 获取一行 I
Data
Record record =
Db
.Northwind.GetRow( "SELECT ProductName, SupplierID FROM Products WHERE ProductID=115"); int supplierId = Convert.ToInt32(record["SupplierID"]); // 在不用在意资源释放的情况下使用
Data
Reader,利用了foreach的机制,在循环结束后
Data
Reader会自动关闭 IEnumerable
DataRecord> rows =
Db
.Northwind.Rows( "SELECT ProductName, SupplierID FROM Products WHERE ProductID=115"); foreach (I
Data
Record row in rows) { Console.WriteLine(row["ProductName"]); } 使用参数和调用存储过程 // 使用参数
Db
Parameter
parameter
=
Db
.Northwind.Create
Parameter
();
parameter
.
Db
Type =
Db
Type.String;
parameter
.
Parameter
Name = "CustomerID";
parameter
.Value = "ALFKI";
parameter
.Direction =
Parameter
Direction.Input; // 调用存储过程 CustOrderHist @CustomerID
Data
Set ds =
Db
.Northwind.
Data
Set( "CustOrderHist", new[] {
parameter
}, CommandType.StoredProcedure); // 使用
Db
ClientParamEx
中
的扩展方法快速创建参数(需要using
Data
命名空间)
Db
Parameter
[]
parameter
s = new[] {
Db
.Northwind.Create
Parameter
("id",
Db
Type.Int32, 115, direction:
Parameter
Direction.Input),
Db
.Northwind.Create
Parameter
("name",
Db
Type.String, "Ikura", 5) };
Db
.Northwind.
Data
Set("SELECT * FROM Products WHERE ProductName=@name OR ProductID=@id",
parameter
s); 使用Mapper IMapper
接口
定义了从I
Data
Record到T类型的映射,可以用过
实现
该
接口
,以便从数据库读取并创建特定类型实例及实例的集合。 public class Product { public int ProductID; public string ProductName; } public class ProductMapper : IMapper
{ public Product MapRow(I
Data
Record record, int rowNum) { var product = new Product(); product.ProductID = Convert.ToInt32(record["ProductID"]); product.ProductName = record["ProductName"].ToString(); return product; } } 利用上面的ProductMapper,我们可以直接从查询
中
创建Product实例了。 // 获取一个实例 Product product =
Db
.Northwind.Get( new ProductMapper(), "SELECT * FROM Products WHERE ProductID=115"); // 获取实例的集合 IList
products =
Db
.Northwind.List(new ProductMapper(), "SELECT * FROM Products"); Mappers类
中
已经定义了部分简单类型的Mapper
实现
,以便
实现
便捷的查询。 // 使用已定义好的简单Mapper IList
productNames =
Db
.Northwind.List( Mappers.String(), "SELECT ProductName FROM Products"); IList
productIds =
Db
.Northwind.List( Mappers.Int32(), "SELECT ProductID FROM Products"); // 使用
实现
IConvertible的类型创建Mapper IList
orderDates =
Db
.Northwind.List( Mappers.Convertible
(), "SELECT OrderDate FROM Orders"); 使用事务 使用CreateTransaction方法来获取一个ITransactionKeeper事务容器。获取到的事务容器自身也
实现
了
I
Db
Client,可以在其上进行各种CRUD操作。 事务的最后,别忘了Commit。 ITransactionKeeper同时也
实现
了IDisposable
接口
,其Dispose方法能够在事务没有提交时进行事务回滚(如果已经提交,则什么也不做),利用这个机制和C#的using语法,可以很方便的编写一个在出现异常时回滚的事务操作。 using (ITransactionKeeper tran =
Db
.Northwind.CreateTransaction()) { tran.Execute("UPDATE Products SET ProductName='The Name' WHERE ProductID=115"); tran.Execute("UPDATE Products SET ProductName='The Name2' WHERE ProductID=118"); tran.Commit(); } Dynamic扩展 在
Data
.Dynamic命名空间的ObjectiveExtension类
中
,定义了一套
I
Db
Client的扩展方法,能够使用更快捷的方式进行数据库操作。 .net对象传参 这些扩展方法具有与
I
Db
Client
中
的方法很类似的签名,但能够接收一个用于存放参数信息的.net对象,以节省许多编码量(是的,和Dapper、ServiceStack.OrmLite很相似)。 通过这些扩展方法,上面使用参数的示例可以这样写了:
Data
Set ds =
Db
.Northwind.
Data
Set( "CustOrderHist", new { CustomerID = "ALFKI" }, CommandType.StoredProcedure);
Data
Table dt =
Db
.Northwind.
Data
Table( "SELECT * FROM Products WHERE ProductName=@name OR ProductID=@id", new { name = "Ikura", id = 115 }); 获取类型实例 现在不指定Mapper就可以直接进行对象查询了。 Product product =
Db
.Northwind.Get
("SELECT * FROM Products WHERE ProductID=115"); IList
products =
Db
.Northwind.List
("SELECT * FROM Products"); IList
orderDates =
Db
.Northwind.List
("SELECT OrderDate FROM Orders"); 在这些方法内部,会在运行时动态生成对应的Mapper,并且生成一次以后,信息会被缓存下来,不需要每次都重新创建。当然,因为做了更多的是事情,它还是会比非扩展的原生版本慢那么一点点。 也可以使用匿名对象作为实体模板,在许多场景尤其是处理包含少量字段(但又多于1个)时尤其方便。 var template = new { ProductID = 0, ProductName = string.Empty }; var productsByTemplate =
Db
.Northwind.TemplateList(template, "SELECT * FROM Products"); 关于字段名称的匹配 .net对象的
属性
和公共字段使用Pascal命名法,但数据库规范
中
的字段命名法可能不一样,比如MySql的snake_case命名法;而且也有太多的数据库设计使用“意识流”了。为了解决这个命名差异问题,查询结果映射到非匿名对象字段时支持字段名称的模糊匹配,具体规则如下,越靠前的规则优先级越高: 查询结果的字段名称和对象字段名称完全一致; 大小写不敏感的匹配;例:查询结果字段goodName可映射到对象字段GoodName。 查询结果的字段名称移除下划线(头尾的下划线将保留)之后,再进行大小写不敏感的匹配;例:查询结果字段good_name可映射到对象字段GoodName;_goodName不会映射到GoodName,因为头尾的下划线不会被忽略。 字体匹配时,考前的规则将优先进行匹配,没有匹配到的字段再使用下一优先级的规则进行匹配。若所有规则都为命
中
,则对象字段将在映射
中
被忽略从而保持字段类型的默认值。 注意:使用匿名对象作为模板查询时,匿名对象的字段名称需和查询结果的字段名称完全匹配,不支持模糊匹配。 Indexing扩展 在
Data
.Indexing命名空间的IndexingExtension类
中
,定义了另外一套
I
Db
Client的扩展方法,能够基于索引访问传入的参数。 记得string.Format方法吗: string.Format("My name is {0}, I'm {1} years old.", "John Doe", 8); 类似的,这些扩展方法用起来是这个样子的:
Data
Table dt =
Db
.Northwind.
Data
Table( "SELECT * FROM Products WHERE ProductName=@0 OR ProductID=@1", "Ikura", 115); IList
products =
Db
.Northwind.List
( "SELECT * FROM Products WHERE ProductID IN (@0, @1)", 15, 16); 通常在一个地方并不混用两套扩展。Dynamic扩展会更泛用一些,但在一些特定的场景下,使用Indexing扩展也是个好主意。还有,这套扩展方法速度会更快一些。
C#数据库操作类-SQLHelper
C#数据库操作类-SQLHelper,方便操作Sql数据库,源代码,下载即可使用.
超牛×的
DB
Helper类
using System.Text; using System.
Data
.Common; using System.
Data
; using System.Configuration; namespace HomeAndSchool.DAL { public class
DB
Helper { private static string
db
ProviderName = ConfigurationManager.AppSettings["
Db
HelperProvider"]; private static string
db
ConnectionString = ConfigurationManager.ConnectionStrings["
Db
HelperConnectionString"].ToString(); private
Db
Connection connection; public
DB
Helper() { this.connection = CreateConnection(
DB
Helper.
db
ConnectionString); } public
DB
Helper(string connectionString) { this.connection = CreateConnection(connectionString); } /// /// 获得
Db
Connection /// /// public static
Db
Connection CreateConnection() {
Db
ProviderFactory
db
factory =
Db
ProviderFactories.GetFactory(
DB
Helper.
db
ProviderName);
Db
Connection
db
conn =
db
factory.CreateConnection();
db
conn.ConnectionString =
DB
Helper.
db
ConnectionString; return
db
conn; } /// /// 获得
Db
Connection /// /// connectionString /// public static
Db
Connection CreateConnection(string connectionString) {
Db
ProviderFactory
db
factory =
Db
ProviderFactories.GetFactory(
DB
Helper.
db
ProviderName);
Db
Connection
db
conn =
db
factory.CreateConnection();
db
conn.ConnectionString = connectionString; return
db
conn; } /// /// 执行的存储过程 /// /// /// public
Db
Command GetStoredProcCommond(string storedProcedure) {
Db
Command
db
Command = connection.CreateCommand();
db
Command.CommandText = storedProcedure;
db
Command.Comman
.NET
Db
Helper 数据访问类(MSSQL Mysql ORACLE)
个人曾经写过的数据访问
接口
,包含:MSSQL、Mysql、Oracle等数据库的公共处理
接口
。可以拿过来直接使用,放在手里好多年了。 I
Data
base
接口
声明如下: namespace Simple.
Data
base { /// /// I
Data
base
接口
/// public interface I
Data
base {
Db
Connection
db
Conn { get; set; } /// /// 创建
Db
Connection 对象实例。 /// ///
Db
Connection 对象实例。
Db
Connection CreateConnection(); /// /// 创建
Db
Command 对象实例。 /// ///
Db
Command 对象实例。
Db
Command CreateCommand(); /// /// 创建
Db
Command 对象实例。 /// /// Sql 语句或存储过程名。 /// CommandType 参数。 ///
Db
Command 对象实例。
Db
Command CreateCommand(string text, CommandType type); /// /// 创建
Db
Command 对象实例。 /// /// Sql 语句或存储过程名。 /// CommandType 参数。 /// 参数集合。 ///
Db
Command 对象实例。
Db
Command CreateCommand(string text, CommandType type, I
Data
Parameter
[] paras); /// /// 创建
Db
Command 对象实例。 /// ///
Db
Connection 对象。 /// Sql 语句或存储过程名。 /// CommandType 参数。 /// 参数集合。 ///
Db
Command 对象实例。
Db
Command CreateCommand(
Db
Connection conn, string text, CommandType type, I
Data
Parameter
[] paras); /// /// 创建
Db
Data
Adapter 对象实例。 /// ///
Db
Data
Adapter 对象实例。
Db
Data
Adapter Create
Data
Adapter(); /// /// 创建
Db
Parameter
对象实例。 /// ///
Db
Parameter
对象实例。
Db
Parameter
Create
Parameter
(); /// /// 创建
Db
Parameter
对象实例。 /// /// 参数名称。 /// 参数值。 ///
Db
Parameter
对象实例。
Db
Parameter
Create
Parameter
(string name, Object value); /// /// 创建
Db
Parameter
对象实例。 /// /// 参数名称。 /// 参数类型。 ///
Db
Parameter
对象实例。
Db
Parameter
Create
Parameter
(string name,
Db
Type type); /// /// 创建
Db
Parameter
对象实例。 /// /// 参数名称。 /// 参数类型。 /// 数据的最大大小。 ///
Db
Parameter
对象实例。
Db
Parameter
Create
Parameter
(string name,
Db
Type type, int size); /// /// 获取指定长度数据的
Data
Set 对象。 /// /// 要读取的 Sql 语句。 /// 开始读取位置的索引。 /// 待读取记录集的长度。 ///
Data
Set 对象。
Data
Set Get
Data
Set(string sql, int start, int length); /// /// 获取指定长度数据的
Data
Table 对象。 /// /// 要读取的 Sql 语句。 /// 开始读取位置的索引。 /// 待读取记录集的长度。 ///
Data
Table 对象。
Data
Table Get
Data
Table(string sql, int start, int length); /// /// 执行Insert、Update、Delete等操作,并返回受影响的记录数。 /// /// 要执行的 Sql 语句。 /// 受影响的记录数。 int GetEffect(string sql); /// /// 执行 Insert、Update、Delete 等操作,并返回受影响的记录数。 /// /// 要执行的 Sql 语句或存储过程名等。 /// CommandType 的类型,即该命令是 Sql 语句,还是存储过程名等。 /// 受影响的记录数。 int GetEffect(string sql, CommandType type); /// /// 执行带参数的 Sql 语句或存储过程,并返回受影响的记录数。 /// /// 要执行的 Sql 语句或存储过程名等。 /// CommandType 参数类型,即该命令是 sql 语句,还是存储过程名等。 /// 参数集合。 /// 受影响的记录数。 int GetEffect(string text, CommandType type, I
Data
Parameter
[] paras); /// /// /// /// /// /// /// /// /// int GetEffect(
Db
Connection conn, string text, CommandType type, I
Data
Parameter
[] paras,
Db
Transaction
Db
Trans); /// /// /// /// /// List ExecuteTransaction(params string[] sqls); /// /// 执行 Select 语句,并返回
Data
Set 对象。 /// /// 要执行的 Sql 语句。 ///
Data
Set 对象。
Data
Set Get
Data
Set(string sql); /// /// 执行 Select 语句或存储过程,并返回
Data
Set 对象。 /// /// 要执行的 Sql 语句或存储过程名等。 /// CommandType 参数类型,即该命令是 sql 语句,还是存储过程名等。 ///
Data
Set 对象。
Data
Set Get
Data
Set(string text, CommandType type); /// /// 执行带参数的 Sql 语句或存储过程,并返回
Data
Set 对象。 /// /// 要执行的 Sql 语句或存储过程名等。 /// CommandType 参数类型,即该命令是 sql 语句,还是存储过程名等。 /// 参数集合。 ///
Data
Set 对象。
Data
Set Get
Data
Set(string text, CommandType type, I
Data
Parameter
[] paras); /// /// 执行 Select 语句,并返回
Data
Table 对象。 /// /// 要执行的 Sql 语句。 ///
Data
Table 对象。
Data
Table Get
Data
Table(string sql); /// /// 执行 Select 语句或存储过程,并返回
Data
Table 对象。 /// /// 要执行的 Sql 语句或存储过程名等。 /// CommandType 参数类型,即该命令是 sql 语句,还是存储过程名等。 ///
Data
Table 对象。
Data
Table Get
Data
Table(string text, CommandType type); /// /// 执行带参数的 Sql 语句或存储过程,并返回
Data
Table 对象。 /// /// 要执行的 Sql 语句或存储过程名等。 /// CommandType 参数类型,即该命令是 sql 语句,还是存储过程名等。 /// 参数集合。 ///
Data
Table 对象。
Data
Table Get
Data
Table(string text, CommandType type, I
Data
Parameter
[] paras); /// /// 获取查询所返回的结果集
中
第一行第一列的值。 /// /// 要处理的 sql 语句(包含待查询的字段)。 /// 字段值。 object GetField(string sql); /// /// 获取查询所返回的结果集
中
第一行指定列的值。 /// /// 待查询的数据表名称。 /// 待获取字段的列名。 /// 字段值。 object GetField(string sql, string field); /// /// 获取查询所返回的结果集
中
第一行指定列集合的值。 /// /// 要处理的 sql 语句。 /// 待获取字段的列表。 /// 字段值集合。 object[] GetField(string sql, params string[] fields); } }
C#
110,538
社区成员
642,577
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章