紫天连水

雄关漫道真如铁,而今迈步从头越
posts - 6, comments - 16, trackbacks - 1, articles - 0
  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理

2007年4月25日

代码是这样的,得要装vfpodbc.dll。

posted @ 2007-04-25 17:29 紫天连水 阅读(215) 评论(0) 编辑

2007年1月20日

.net2.0里提供的这个类在某些方面大大减少了事务处理的代码量。
TransactionScope
类可以用来标志一段代码参与一个事务,它不要求使用者与事务直接接触。 TransactionScope类可以自动管理周边的事务。看看MSN里的这段代码。
using (TransactionScope ts = new TransactionScope())
{
    
//Create and open the SQL connection.  The work done on this connection will be a part of the transaction created by the TransactionScope
    SqlConnection myConnection = new SqlConnection("server=(local)\\SQLExpress;Integrated Security=SSPI;database=northwind");
    SqlCommand myCommand 
= new SqlCommand();
    myConnection.Open();
    myCommand.Connection 
= myConnection;

    
//Restore database to near it's original condition so sample will work correctly.
    myCommand.CommandText = "DELETE FROM Region WHERE (RegionID = 100) OR (RegionID = 101)";
    myCommand.ExecuteNonQuery();

    
//Insert the first record.
    myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'MidWestern')";
    myCommand.ExecuteNonQuery();

    
//Insert the second record.
    myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'MidEastern')";
    myCommand.ExecuteNonQuery();

    myConnection.Close();

                    
//Call complete on the TransactionScope or not based on input
    ConsoleKeyInfo c;
    
while (true)
    {
                            Console.Write(
"Complete the transaction scope? [Y|N] ");
        c 
= Console.ReadKey();
        Console.WriteLine();

        
if ((c.KeyChar == 'Y'|| (c.KeyChar == 'y'))
        {
            
// Commit the transaction
            ts.Complete();
            
break;
        }
        
else if ((c.KeyChar == 'N'|| (c.KeyChar == 'n'))
        {
            
break;
        }
    }
用起来好方便。

posted @ 2007-01-20 17:36 紫天连水 阅读(1399) 评论(1) 编辑

2006年11月9日

摘要: 三步走。
<1>建立数据源
<2>在visio中新建数据库模型图
<3>反向工程
阅读全文

posted @ 2006-11-09 13:34 紫天连水 阅读(4566) 评论(5) 编辑

2006年10月25日

摘要: 新的asp.net ajax UpdatePanel使用方便,强能强大。通过看文档,理解一些用法。阅读全文

posted @ 2006-10-25 19:47 紫天连水 阅读(4013) 评论(4) 编辑

新建一个Asp.net Ajax-Enabled Web Site,using发现多了13个namespace.如下
using Microsoft.Web.Configuration;
using Microsoft.Web.Handlers;
using Microsoft.Web.Profile;
using Microsoft.Web.Resources;
using Microsoft.Web.Script.Serialization;
using Microsoft.Web.Script.Services;
using Microsoft.Web.Security;
using Microsoft.Web.UI;
using Microsoft.Web.UI.Compatibility;
using Microsoft.Web.UI.Controls;
using Microsoft.Web.UI.Controls.Design;
using Microsoft.Web.UI.Design;
using Microsoft.Web.Util;
安装asp.net ajax 1.0 beta时,Microsoft.Web.Extensions.dll被注册到GAC(全局命名空间,C:\WINDOWS\assembly),所以以为都是Microsoft.Web.Extensions.dll中的命名空间。用vs2005的object brower看了一下Microsoft.Web.Extensions.dll:

只有几个namespace.
这四个多出的命名空间是从哪里来的?
using Microsoft.Web.Profile;
using Microsoft.Web.Resources;
using Microsoft.Web.Security;
using Microsoft.Web.Util;

posted @ 2006-10-25 12:29 紫天连水 阅读(913) 评论(1) 编辑

2006年10月24日

摘要: asp.net ajax helloworld程序,并说明了与atlas的几点区别。阅读全文

posted @ 2006-10-24 14:24 紫天连水 阅读(992) 评论(5) 编辑