access数据库,ASP.NET如何实现计数器?急!!!

解决方案 »

  1.   

    你不用文件  access数据库就是文件型的
    读取速度也是很慢的!!  还不如使用文件呢!!
      

  2.   

    我是从来不记这些东西的看看这个吧表示 SQL Server 数据库的一个打开的连接。不能继承此类。有关此类型所有成员的列表,请参阅 SqlConnection 成员。System.Object
       System.MarshalByRefObject
          System.ComponentModel.Component
             System.Data.SqlClient.SqlConnection[Visual Basic]
    NotInheritable Public Class SqlConnection
       Inherits Component
       Implements IDbConnection, ICloneable[C#]
    public sealed class SqlConnection : Component, IDbConnection,
       ICloneable[C++]
    public __gc __sealed class SqlConnection : public Component,
       IDbConnection, ICloneable[JScript]
    public class SqlConnection extends Component implements
       IDbConnection, ICloneable线程安全
    此类型的所有公共静态(Visual Basic 中为 Shared)成员对多线程操作而言都是安全的。但不保证任何实例成员是线程安全的。备注
    SqlConnection 对象表示与 SQL Server 数据源的一个唯一的会话。对于客户端/服务器数据库系统,它相当于到服务器的网络连接。SqlConnection 与 SqlDataAdapter 和 SqlCommand 一起使用,以便在连接 Microsoft SQL Server 数据库时提高性能。对于所有第三方 SQL 服务器产品以及其他支持 OLE DB 的数据源,请使用 OleDbConnection。当创建 SqlConnection 的实例时,所有属性都设置为它们的初始值。有关这些值的列表,请参见 SqlConnection 构造函数。如果 SqlConnection 超出范围,则不会将其关闭。因此,必须通过调用 Close 或 Dispose 显式关闭该连接。注意   若要部署高性能应用程序,则需要使用连接池。在使用 SQL Server .NET Framework 数据提供程序时,不需要启用连接池,因为提供程序会自动对此进行管理,不过您可以修改某些设置。有关联合使用 SQL Server .NET Framework 数据提供程序和连接池的更多信息,请参见 SQL Server .NET Framework 数据提供程序连接池。
    如果执行 SqlCommand 的方法生成 SqlException,那么当严重度等于或小于 19 时,SqlConnection 将仍保持打开状态。当严重度等于或大于 20 时,服务器通常会关闭 SqlConnection。但是,用户可以重新打开连接并继续操作。创建 SqlConnection 对象的实例的应用程序可通过设置声明性或强制性安全请求,要求所有直接和间接的调用者具有足够的权限访问代码。SqlConnection 使用 SqlClientPermission 对象提出安全请求。用户可以使用 SqlClientPermissionAttribute 对象来验证他们的代码是否具有足够的权限。用户和管理员还可以使用代码访问安全策略工具 (Caspol.exe) 来修改计算机、用户和企业级别的安全策略。有关更多信息,请参见保证应用程序的安全。注意   如果您正在使用 Microsoft .NET Framework 1.0 版,则在使用 Open 连接到 SQL Server 时必须使用 FullTrust 命名权限集。但如果使用的是 NET Framework 1.1 版,则无须使用它。有关更多信息,请参见请求权限和命名的权限集。
    有关处理来自服务器的警告和信息性消息的更多信息,请参见使用连接事件。示例
    [Visual Basic, C#] 下面的示例创建一个 SqlCommand 和一个 SqlConnection。SqlConnection 打开,并设置为 SqlCommand 的 Connection。然后,该示例调用 ExecuteNonQuery 并关闭该连接。为了完成此任务,将为 ExecuteNonQuery 传递一个连接字符串和一个查询字符串,后者是一个 Transact-SQL INSERT 语句。[Visual Basic] 
    Public Sub InsertRow(myConnectionString As String)
        ' If the connection string is null, use a default.
        If myConnectionString = "" Then
            myConnectionString = "Initial Catalog=Northwind;Data Source=localhost;Integrated Security=SSPI;"
        End If
        Dim myConnection As New SqlConnection(myConnectionString)
        Dim myInsertQuery As String = "INSERT INTO Customers (CustomerID, CompanyName) Values('NWIND', 'Northwind Traders')"
        Dim myCommand As New SqlCommand(myInsertQuery)
        myCommand.Connection = myConnection
        myConnection.Open()
        myCommand.ExecuteNonQuery()
        myCommand.Connection.Close()
    End Sub 'SelectSqlClientSrvRows[C#] 
    public void InsertRow(string myConnectionString) 
     {
        // If the connection string is null, use a default.
        if(myConnectionString == "") 
        {
           myConnectionString = "Initial Catalog=Northwind;Data Source=localhost;Integrated Security=SSPI;";
        }
        SqlConnection myConnection = new SqlConnection(myConnectionString);
        string myInsertQuery = "INSERT INTO Customers (CustomerID, CompanyName) Values('NWIND', 'Northwind Traders')";
        SqlCommand myCommand = new SqlCommand(myInsertQuery);
        myCommand.Connection = myConnection;
        myConnection.Open();
        myCommand.ExecuteNonQuery();
        myCommand.Connection.Close();
     }[C++, JScript] 没有可用于 C++ 或 JScript 的示例。若要查看 Visual Basic 或 C# 示例,请单击页左上角的“语言筛选器”按钮 。要求
    命名空间: System.Data.SqlClient平台: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列, .NET Framework 精简版 - Windows CE .NET程序集: System.Data (在 System.Data.dll 中)请参见
    SqlConnection 成员 | System.Data.SqlClient 命名空间 | SqlDataAdapter | SqlCommand | SqlConnection 成员(Visual J# 语法) | C++ 托管扩展编程 
    --------------------------------------------------------------------------------发送有关此主题的意见 © 2001-2002 Microsoft Corporation。保留所有权利。