发布NBearLite v1.0.0 beta - 全面支持SqlServer,Oracle,MySql,PostgreSql数据库存储过程调用代码生成(C#/VB.NET)

NBearLite 更新至v1.0.0.6 beta 

全面支持SqlServer,Oracle,MySql,PostgreSql数据库存储过程调用代码生成(C#/VB.NET),支持输入、输出、返回等各种参数类型。

支持Sub Query。

支持Save DataTable/DataRow。

详见:http://www.cnblogs.com/teddyma/archive/2007/07/20/825384.html


使用简介

使用NBearLite.QueryColumnsGenerator.exe工具并指定目标数据库类型和连接字符串,生成的存储过程调用代码类似下面这样:

 1            public static System.Data.DataSet SalesByCategoryTest(NBearLite.Database db, out int RETURN_VALUE, string CategoryName, string OrdYear, ref string OutP) {
 2                if ((db == null)) {
 3                    throw new System.ArgumentNullException("db""Parameter: db could not be null!");
 4                }

 5                NBearLite.StoredProcedureSection spSection = db.StoredProcedure("SalesByCategoryTest");
 6                System.Collections.Generic.Dictionary<stringobject> outValues;
 7                spSection.SetReturnParameter("RETURN_VALUE", System.Data.DbType.Int32, 0);
 8                spSection.AddInputParameter("CategoryName", System.Data.DbType.String, CategoryName);
 9                spSection.AddInputParameter("OrdYear", System.Data.DbType.String, OrdYear);
10                spSection.AddInputOutputParameter("OutP", System.Data.DbType.String, 5, OutP);
11                System.Data.DataSet ds = spSection.ToDataSet(out outValues);
12                RETURN_VALUE = ((int)(outValues["RETURN_VALUE"]));
13                OutP = ((string)(outValues["OutP"]));
14                return ds;
15            }

调用该代码的示例:

int ret = -1;
string outStr = "";
DataSet ds = Northwind.SalesByCategoryTest(db, 
out ret, "test1""1997"ref outStr);

存储过程SalesByCategoryTest包含四个参数,分别是两个输入,一个输出(对应out参数),一个输入输出参数(对应ref参数),同时还返回一个DataSet。

更多关于NBearLite的介绍可以访问:http://www.cnblogs.com/teddyma/archive/2007/07/20/825384.htmlhttp://nbear.org


附录:NBearV4预告及开发团队成员征集
posted @ 2007-07-23 15:08  Teddy's Knowledge Base  Views(5954)  Comments(15Edit  收藏  举报