using MDAA to execute a literal SQL (db.ExecuteScalar like sqlCommand.ExecuteScalar) Database db = DatabaseFactory.CreateDatabase("QuickStarts Instance"); int count = (int)db.ExecuteScalar( CommandType.Text, "SELECT COUNT(*) FROM Customers");
count为什么是0? a a a 最后发现,我执行了BAT文件确实在.\SQLEXPRESS下创建了数据库EntLibQuickStarts; 因为Syntax error 所以各个表中没有数据。 然后又用Query在SQL Server 2005下(数据库是DYLANBOX)创建了EntLibQuickStarts,表中有数据。 所以用 connectionString: Data Source=DYLANBOX;Initial Catalog=EntLibQuickStarts;Integrated Security=True 才正确
db.ExecuteDataSet Database db = DatabaseFactory.CreateDatabase(); DataSet ds = db.ExecuteDataSet( CommandType.Text, "SELECT * From Customers"); dataGrid1.DataSource = ds.Tables[0];
注意:DatabaseFactory.CreateDatabase()只是定义一个Dabase reference db.ExecuteScalar / db.ExecuteDataSet 等 responsible for opening and closing the connection to the real database defined in the configuration file
db.ExecuteReader("") for procedure using (IDataReader dataReader = _db.ExecuteReader("GetCategories")) { // Processing code while (dataReader.Read()) { Category item =new Category( dataReader.GetInt32(0), dataReader.GetString(1), dataReader.GetString(2)); this.cmbCategory.Items.Add(item); } }
// Procedure in Categories.sql // OSQL -S (local)\SQLEXPRESS -E -i Categories.sql CREATE PROCEDURE dbo.GetCategories AS /* SET NOCOUNT ON */ SELECT CategoryID, CategoryName, Description FROM Categories RETURN GO
不用存储过程怎么写?
substitude of above 'using procedure' DataSet ds = _db.ExecuteDataSet(CommandType.Text, "Select * from categories"); foreach (DataRow dr in ds.Tables[0].Rows) { Category item =new Category(int.Parse(dr[0].ToString()), dr[1].ToString(), dr[2].ToString()); this.cmbCategory.Items.Add(item); }
--///////////////////////////////////////////////////////////////////// CREATE Procedure GetProductsByCategory ( @CategoryID int ) AS
SELECT ProductID, ProductName, CategoryID, UnitPrice, LastUpdate FROM Products WHERE CategoryID = @CategoryID
RETURN 0 GO
//不用存储过程 String sel =string.Format("SELECT Products.* FROM Products INNER JOIN Categories ON Products.CategoryID = Categories.CategoryID WHERE Categories.CategoryID = {0}", selectedCategory.CategoryId);
题外话: cast untype dataset to type dataset _db.ExecuteDataSet返回的是一个UnTyped dataSet,转为Typed // load the generic data from the data layer into a strongly typed dataset dsTyped.Load( dsUntyped.Tables[0].CreateDataReader(), LoadOption.OverwriteChanges, dsTyped.mytablename);
最近mysql数据库经常死掉,用命令net stop mysql命令也无法停掉,关闭Tomcat的时候,出现Waiting for N instance(s) to be deallocated 信息。查了下,大概就是程序没有对数据库连接释放,导致Connection泄露了。因为用的是开元集成的平台,内部程序也不可能一下子给改掉的,就验证一下咯。启动Tomcat,用户登录系统,用netstat -
var a=document.getElementsByClassName('textinput');
var b=[];
for(var m=0;m<a.length;m++){
if(a[m].getAttribute('placeholder')!=null)
b.push(a[m])
}
var l
错误信息:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cartService': Scope 'session' is not active for the current thread; consider defining a scoped
这个开源软件包是国内的一位高手自行研制开发的,正如他所说的一样,我觉得它可以使一个工作流引擎上一个台阶。。。。。。欢迎大家使用,并提出意见和建议。。。
----------转帖---------------------------------------------------
IK Expression是一个开源的(OpenSource),可扩展的(Extensible),基于java语言
1.在thingking in java 的第四版第六章中明确的说了,子类对象中封装了父类对象,
2."When you create an object of the derived class, it contains within it a subobject of the base class. This subobject is the sam
http://www.sap.com/corporate-en/press.epx?PressID=14787
有机会研究下EIM家族的两个新产品~~~~
New features of the 4.0 releases of BI and EIM solutions include:
Real-time in-memory computing –
结构
继承关系
public final class Manifest extends Objectjava.lang.Objectandroid.Manifest
内部类
class Manifest.permission权限
class Manifest.permission_group权限组
构造函数
public Manifest () 详细 androi
关键字:Oracle实现类split函数的方
项目里需要保存结构数据,批量传到后他进行保存,为了减小数据量,子集拼装的格式,使用存储过程进行保存。保存的过程中需要对数据解析。但是oracle没有Java中split类似的函数。从网上找了一个,也补全了一下。
CREATE OR REPLACE TYPE t_split_100 IS TABLE OF VARCHAR2(100);
cr