易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

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& ......

JavaScript与C# Windows应用程序交互方法

一、建立网页
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<script language="javascript" type="text/javascript">
<!-- 提供给C#程序调用的方法 -->
function messageBox(message)
{
alert(message);
}
</script>
</head>
& ......

C#一次连接数据库执行多条sql语句(三种方法)

第一种方法:
            string str="server=.;uid=sa;pwd=111111;database=text_db";//连接字符串
            SqlConnection SCON = null;//连接对象
       &n ......

C#(ASP.NET) 下载数据

Internet 类
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading;
namespace DownData
{
    class internet
    {
 &nb ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号