自己写的操纵SQLite数据库的SQLHelper,备忘的-_-(VS2005 C#)

前端之家收集整理的这篇文章主要介绍了自己写的操纵SQLite数据库的SQLHelper,备忘的-_-(VS2005 C#)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

System;

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

using System.Collections.Generic;

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

using System.Text;

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

using System.Data;

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

using System.Data.sqlite;

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

using System.Data.Common;

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/None.gif">


PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/None.gif">

namespace WM

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

{

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

class sqlHelper

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

{

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

//建库

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

public DbConnection getCon()

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

{

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

DbConnection con = new sqliteConnection();

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

con.ConnectionString = "Data Source=WebMan.db";

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

return con;

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

}

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

//建表

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

public void CreateWebTable(DbConnection con)

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

{

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

con.Open();

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

try

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

{

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

using (DbCommand com = con.CreateCommand())

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

{

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

com.CommandText = "create table webtable( id integer primary key,username varchar(20),qiyename varchar(50),webname varchar(50),tel varchar(20),lianxiren varchar(20),fufeidate varchar(10),daoqidate varchar(10),price varchar(10),status varchar(10),yewuyuan varchar(15),mark varchar(50))";

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

com.ExecuteNonQuery();

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

com.CommandText = "create table yewutable( id integer primary key,num varchar(20),workername varchar(20),gender varchar(5),age varchar(5),bear varchar(10),fromwhere varchar(60),mark varchar(50))";

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

com.ExecuteNonQuery();

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

com.CommandText = "create table usertable( id integer primary key,pwd varchar(20))";

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

com.ExecuteNonQuery();

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

}

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

}

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

catch (Exception)

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

{

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">


PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

}

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

}

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

//查询

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

public DataSet Query(DbConnection con,string sql)

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

{

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

DataSet ds = new DataSet();

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

DbDataAdapter da = new sqliteDataAdapter(sql,(sqliteConnection)con);

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

da.Fill(ds);

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

return ds;

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

}

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

//其它操作

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

public int Control(DbConnection con,string sql)

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

{

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

int i = 0;

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

using (DbCommand com = con.CreateCommand())

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

{

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

com.CommandText = sql;

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

i = com.ExecuteNonQuery();

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

}

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

return i;

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

}

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

}

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

}

PHP?refimg=" + this.src)" src="http://img.jb51.cc/vcimg/static/loading.png" align="top" src="http://approlife.blog.51cto.com/images/editer/InBlock.gif">

猜你在找的Sqlite相关文章