易截截图软件、单文件、免安装、纯绿色、仅160KB

在C#中运用 SQLite

  SQLite 是一个嵌入式的联系数据库系统,运用十分广泛。在一些数据量不大的运用 程序中,假如运用 SQLite可以极大的降低部署时的工作量。 要在C#中运用 SQLite也很基本,只要找一个C#的wrapper就可以了,例如,我运用的就是来自
  http://sqlite.phxsoftware.com/  的一个dll,System.Data.SQLite. 下载下来的文件是SQLite-1.0.65.0-setup.exe。只要安装一下就可以运用了,特别方便。该程序契合 ADO.NET的规范,并且支撑 Visual Studio的可视化表设计器。
  打开Visual Studio 2008,新建一个Console Application,为此项目添加System.Data.SQLite的引用。添加一个数据库连接,此时可以发觉,新建连接中有了一个SQLite Database Connection,挑选此类型的数据连接,并且新建一个文件,
  test.db3. 接下来在新数据库中添加一张表。
  下面开始为此表建立一个Data Access类,以展示在C#中如何 运用 SQLite,可以想象,和操作其他数据库是几乎一样的,感谢ADO.NET的功劳。
  最先是一个实体类 Book.cs:
public class Book
    {
        private int id;
        private string bookName;
        private decimal price; 
        public int ID
        {
            get { return id; }
            set { id = value; }
        }
        public string BookName
        {
            get { return bookName; }
            set { bookName = value; }
        }
        public decimal Price
        {
            get { return price; }
            set { price = value; }
        }
    } 
  编写DAL类:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SQLite; 
namespace ConsoleApplication1
{
    public class BookDAL
    {
        public static bool Create(Book book)
        {
            try
            {
                using (SQLiteConnection conn = new SQLiteConnection("Data Sourc


相关文档:

Javascript函数中调用C#方法

一、后台(.cs文件)方法:
       public string GetString(string name)
        {
            return ("Hello " + name);
        }
&n ......

C#学习及与delphi的比较(一)

刚开始很不习惯c#的风格,哎,先入为主啊,delphi习惯了,{}代替begin/end太扎眼。
属性方法的宣告和代码在一起,没有像delphi分interface/implementation,感觉太乱,都不知道一个class到底有几个方法。
每个属性和方法前面都要单独写private/protected/public,老天,c#是delphi之父设计的揶,怎么不学delphi写一个就行 ......

像ASP一样轻松实现分页显示数据C#

 
代码如下:
<%@ Page Language="C#" Debug="true" %>
<%@Import Namespace="System.Data"%>
<%@Import Namespace="System.Data.SqlClient"%>
<Script Language="C#" runat="server">
int Record_Per_Page;//定义每页显示记录数
int nPageCount;//定义总页数
int nRecCount;//定义总 ......

ASP.NET(C#)常用代码30例

ASP.NET程序中常用的三十三种代码 
1. 打开新的窗口并传送参数: 
  传送参数:
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>")
  接收参数:
string a = Request.QueryString("id");
string& ......

Paging long articles in ASP.NET using C#

Paging long articles in ASP.NET using C#
Long articles are better broken into bite-sized chunks over several pages. With static HTML, this is easily achieved by dividing the article into logical separations and creating separate .htm files for each. Here's how to do it using C# for an article that ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号