资源简介

自己写的SQLite数据操作的简单例子。 有Datagridview,treeView和listView三个作为显示数据。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data.SQLite;
using System.Data;
using System.Configuration;

namespace SQLiteHelper
{
    public class SQLiteHelper
    {

        #region SQlite数据操作

        /// 
        /// 执行SQl语句 返回执行的行数
        /// 

        /// 链接数据库的字符串
        /// sql执行语句
        /// 参数
        public static int SQLiteCommand(string str string SqlString params SQLiteParameter[] Param)
        {
            try
            {
                SQLiteConnection slcn = new SQLiteConnection(str);
                SQLiteCommand slcmd = slcn.CreateCommand();
                PrepareCommand(slcmd slcn null SqlString Param);
                return slcmd.ExecuteNonQuery();
            }
            catch (System.Data.SQLite.SQLiteException ex)
            {
                throw new Exception(ex.Message);
            }
        }

        /// 
        /// 执行SQl语句 返回DataSet
        /// 

        /// 链接数据库的字符串
        /// sql执行语句
        /// 参数
        /// DataSet
        public static DataSet SQLiteCommandDataSet(string str string SqlString params SQLiteParameter[] Param)
        {
            try
            {
                DataSet ds = new DataSet();
                SQLiteConnection slcn = new SQLiteConnection(str);
                SQLiteCommand slcmd = slcn.CreateCommand();
                PrepareCommand(slcmd slcn null SqlString Param);
                SQLiteDataAdapter sda = new SQLiteDataAdapter(slcmd);
                slcmd.Parameters.Clear();
                sda.Fill(ds);
                sda.Dispose();
                return ds;
            }
            catch (System.Data.SQLite.SQLiteException ex)
            {
                throw new Exception(ex.Message);
            }
        }

        /// 
        /// 执行SQl语句 返回数据集SQLiteDataReader
        /// 

        /// 链接数据库的字符串
        /// sql执行语句
        /// 参数
        /// SQLiteDataReader
        public static SQLiteDataReader SQLiteCommandDataReader(string str string SqlString params SQLiteParameter[] Param)
        {
            try
            {
                SQLiteConnection slcn = new SQLiteConnection(str);
                SQLiteCommand slcmd = slcn.CreateCommand();
                PrepareCommand(slcmd slcn null SqlString Param);
                SQLiteDataReader myReader = slcmd.ExecuteReader();
                slcmd.Parameters.Clear();
                return myReader;
            }
            catch (System.Data.SQLite.SQLiteException ex)
            {
                throw new 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5632  2011-11-27 20:21  TestSQLiteFunction\SQLiteHelper\bin\Debug\SQLiteHelper.dll

     文件      13824  2011-11-27 20:21  TestSQLiteFunction\SQLiteHelper\bin\Debug\SQLiteHelper.pdb

     文件     839680  2008-10-02 09:02  TestSQLiteFunction\SQLiteHelper\bin\Debug\System.Data.SQLite.DLL

     文件       5930  2011-11-27 20:21  TestSQLiteFunction\SQLiteHelper\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       4811  2011-11-27 16:39  TestSQLiteFunction\SQLiteHelper\obj\Debug\ResolveAssemblyReference.cache

     文件        662  2011-11-27 17:06  TestSQLiteFunction\SQLiteHelper\obj\Debug\SQLiteHelper.csproj.FileListAbsolute.txt

     文件       5632  2011-11-27 20:21  TestSQLiteFunction\SQLiteHelper\obj\Debug\SQLiteHelper.dll

     文件      13824  2011-11-27 20:21  TestSQLiteFunction\SQLiteHelper\obj\Debug\SQLiteHelper.pdb

     文件       1380  2011-11-27 15:49  TestSQLiteFunction\SQLiteHelper\Properties\AssemblyInfo.cs

     文件       4221  2011-11-27 20:19  TestSQLiteFunction\SQLiteHelper\SQLiteHelper.cs

     文件       2425  2011-11-27 16:39  TestSQLiteFunction\SQLiteHelper\SQLiteHelper.csproj

     文件      14336  2011-11-27 21:01  TestSQLiteFunction\TestSQLiteFunction\bin\Debug\library.db

     文件       5632  2011-11-27 20:21  TestSQLiteFunction\TestSQLiteFunction\bin\Debug\SQLiteHelper.dll

     文件      13824  2011-11-27 20:21  TestSQLiteFunction\TestSQLiteFunction\bin\Debug\SQLiteHelper.pdb

     文件     839680  2008-10-02 09:02  TestSQLiteFunction\TestSQLiteFunction\bin\Debug\System.Data.SQLite.DLL

     文件      11776  2011-11-27 20:53  TestSQLiteFunction\TestSQLiteFunction\bin\Debug\TestSQLiteFunction.exe

     文件      28160  2011-11-27 20:53  TestSQLiteFunction\TestSQLiteFunction\bin\Debug\TestSQLiteFunction.pdb

     文件      11608  2011-11-27 20:55  TestSQLiteFunction\TestSQLiteFunction\bin\Debug\TestSQLiteFunction.vshost.exe

     文件        490  2010-03-17 22:39  TestSQLiteFunction\TestSQLiteFunction\bin\Debug\TestSQLiteFunction.vshost.exe.manifest

     文件       3283  2011-11-27 20:53  TestSQLiteFunction\TestSQLiteFunction\Form1.cs

     文件       5999  2011-11-27 20:53  TestSQLiteFunction\TestSQLiteFunction\Form1.Designer.cs

     文件       5817  2011-11-27 20:53  TestSQLiteFunction\TestSQLiteFunction\Form1.resx

     文件       6395  2011-11-27 20:53  TestSQLiteFunction\TestSQLiteFunction\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        566  2011-11-27 20:53  TestSQLiteFunction\TestSQLiteFunction\obj\x86\Debug\GenerateResource-ResGen.read.1.tlog

     文件        958  2011-11-27 20:53  TestSQLiteFunction\TestSQLiteFunction\obj\x86\Debug\GenerateResource-ResGen.write.1.tlog

     文件       7903  2011-11-27 20:21  TestSQLiteFunction\TestSQLiteFunction\obj\x86\Debug\ResolveAssemblyReference.cache

     文件       1518  2011-11-27 20:55  TestSQLiteFunction\TestSQLiteFunction\obj\x86\Debug\TestSQLiteFunction.csproj.FileListAbsolute.txt

     文件      11776  2011-11-27 20:53  TestSQLiteFunction\TestSQLiteFunction\obj\x86\Debug\TestSQLiteFunction.exe

     文件        180  2011-11-27 20:53  TestSQLiteFunction\TestSQLiteFunction\obj\x86\Debug\TestSQLiteFunction.Form1.resources

     文件      28160  2011-11-27 20:53  TestSQLiteFunction\TestSQLiteFunction\obj\x86\Debug\TestSQLiteFunction.pdb

............此处省略31个文件信息

评论

共有 条评论