SQLServer 2008跨数据库实例事务处理
托了几天的难题,终于解决了。特分享一下
以下是一个存储过程
CREATE PROCEDURE deleteAccountAll
@id int
AS
SET XACT_abort ON
BEGIN DISTRIBUTED TRAN
delete from AccountCapital where accountid = @id
delete from logininfo where username = @id
delete from CapitalRecord where accountid = @id
delete from [Trade]..[order] where accountid = @id
delete from account where id = @id
if @@error<>0
rollback tran
else
commit tran
GO
其中order表与其他几个表不在同一个数据库实例,若想实现事务操作,具体要注意两点:
1.打开MSDTC服务,即 set XACT_abort on ,若本机没有启动,则运行 net start msdtc
2.对不同数据库实例的访问要注意用[数据库实例名]..[表名]
相关文档:
经常看见有人问,MSSQL占用了太多的内存,而且还不断的增长;或者说已经设置了使用内存,可是它没有用到那么多,这是怎么一回事儿呢?
首先,我们来看看MSSQL是怎样使用内存的。
最大的开销一般是用于数据缓存,如果内存足够,它会把用过的数据和觉得你会用到的数据统统扔到内存中,直到内存不足的时候 ......
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlC ......
本文总结如何在.Net Winform和.Net webform(asp.net)中将图片存入sqlserver中并读取显示的方法
1,使用asp.net将图片上传并存入SqlServer中,然后从SqlServer中读取并显示出来
一,上传并存入SqlServer
数据库结构
create table test
{
id identity(1,1),
FImage image
}
相关的存储过程
Create proc UpdateImage ......
世事洞明皆学问,人情练达即文章。做ASP时,最常用的数据库即Sqlserver与Access数据库莫属了!
但使用会经常发现很多SQL执行的问题。这里整理出之间的差异,做个十大差异的总结。
ACCESS结构简单容易处理,而且也能满足多数的网站程序要求,也是初学者的试牛刀。
ACCESS是小型数据库,既然是小型就有他根本的局限性:
......
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Generic;
public class CommandInfo
{
public string CommandText;
public SqlPa ......