SQLite的查询

时间:2021-08-09 08:12:29

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SQLite;

namespace _01复习1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            List<ManagerInfo> list = new List<ManagerInfo>();
            string connStr = @"data source=C:\Users\Administrator\Desktop\2015-05-13.NET就业班-三层项目+SVN\资料\ItcastCater.db;version=3;";
            using (SQLiteConnection conn = new SQLiteConnection(connStr))
            {
                using (SQLiteCommand cmd=new SQLiteCommand("select * from ManagerInfo",conn))
                {
                    conn.Open();
                    SQLiteDataReader reader = cmd.ExecuteReader();
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            list.Add(new ManagerInfo()
                            {
                                MId = int.Parse(reader["MId"].ToString()),
                                MName = reader["MName"].ToString(),
                                MPwd = reader["MPwd"].ToString(),
                                MType = int.Parse(reader["MType"].ToString()),
                            });
                        }
                    }
                    reader.Close();
                    this.dataGridView1.DataSource = list;
                }   
            }
        }
    }
}

SQLite的查询的更多相关文章

  1. IOS开发数据库篇—SQLite模糊查询

    IOS开发数据库篇—SQLite模糊查询 一.示例 说明:本文简单示例了SQLite的模糊查询 1.新建一个继承自NSObject的模型 该类中的代码: // // YYPerson.h // 03- ...

  2. SQLite -插入查询

     SQLite -插入查询 SQLite插入语句是用来添加新行数据到数据库中的一个表. 语法: 有两种基本的插入语句的语法如下: INSERT INTO TABLE_NAME (column1, co ...

  3. SQLite - SELECT查询

    SQLite - SELECT查询 SQLite SELECT语句用于获取数据从一个SQLite数据库表返回数据结果表的形式.也称为result-sets这些结果表. 语法 SQLite SELECT ...

  4. SQLite 参数化查询

    SQLite参数化查询 首先给出两个参考博客: Sqlite DB sqlite3使用简介 贴出一段自己用的代码: #include <stdio.h> #include <stdl ...

  5. sqlite常用查询

    做的小工具用到了sqlite,在查询上较sqlserver还是稍有差异,将常用操作汇总一下,慢慢收集和整理. --查询版本SELECT sqlite_version() AS 'SQLite Vers ...

  6. Android SQLite 通配符查询找不到参数问题

    使用Android SQLite中SQLiteDatabase类的query方法查询时,如果where中包含通配符,则参数会无法设置,如类似下面的方法查询时 SQLiteDatabase db = d ...

  7. SQLite区分大小写查询

    http://www.cnblogs.com/zhuawang/archive/2013/01/15/2861566.html 大部分数据库在进行字符串比较的时候,对大小写是不敏感的.但是,在SQLi ...

  8. SQLite -- 分页查询

    原文:http://blog.csdn.net/lu1024188315/article/details/51734514 参考:http://www.runoob.com/sqlite/sqlite ...

  9. sqlite数据库查询批量

    采网页里的网址,网址每天都变化,而数据库里有几千条数据,通过 select count(*) 来查找数据库里有没有该网址,没有的话就采集入库,所 以如果网页当天更新1千条连接,那采集一次就要selec ...

随机推荐

  1. xshell有大量打印时,显示信息不全

    使用xshell远程登录ssh时,编译大型工程或在minicom打印嵌入式设备的信息,发现显示不全. 在网上搜索了一下也没有发现有解决办法. 经过实验发现 xshell terminal type设置 ...

  2. Atom插件安装

    Atom插件安装 Atom狂拽炫酷插件之activate-power-mode 引语: 在前文中提到了关于插件的安装,似乎简单易操作,不过最后我发现是我自己想简单了. activate-power-m ...

  3. Java api

    StringBuilder.charAt(int index); StringBuilder.deleteCharAt(int index); StringBuilder.setCharAt(int ...

  4. 如何查看LINUX 硬件配置信息

    如何查看LINUX 硬件配置信息 在网上找了N久,发现了一篇不错的文档,转载一下: 1.查看机器所有硬件信息: dmidecode |more dmesg |more 这2个命令出来的信息都非常多,所 ...

  5. Win64位操作系统无法运行暗黑2战网D2GS的解决办法

    前几天想在我的Win7 x64系统里做个战网自己玩,搭建完毕后进入战网创建房间出现经典的问题,“排队1”. 原因很清楚,就是D2GS无法启动:但是使用之前的各种办法尝试后无果,后来查看D2GS同目录下 ...

  6. 根据查询结果创建新表create table &period;&period; as &lpar;select&period;&period;&period;&period;&rpar;

    一张表 student 查询数学和英语都是90分以上的同学,并创建一张新表 test1

  7. C&period; Painting the Fence

    链接 [https://codeforces.com/contest/1132/problem/C] 题意 就是有个n长的栅栏,然后每个油漆工可以染的区域不同 给你q让你选出q-2个人使得被染色的栅栏 ...

  8. &lbrack;转帖&rsqb;Nginx的超时keeplive&lowbar;timeout配置详解

    Nginx的超时keeplive_timeout配置详解 https://blog.csdn.net/weixin_42350212/article/details/81123932   Nginx  ...

  9. python yaml

    一.安装PyYAML http://pyyaml.org/ 二.入门参考 http://www.cnblogs.com/c9com/archive/2013/01/05/2845539.html ht ...

  10. swift 学习之 UIAlertViewController

    // //  PushViewController.swift //  tab // //  Created by su on 15/12/7. //  Copyright © 2015年 tian. ...