using Microsoft.Data.Sqlite;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Data;
using System.Data.Common;
using System.Linq;

namespace ConsoleAppLinqTest
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] scores = new int[] { 97, 92, 81, 60, 54, 94, 75, 66 };

            IEnumerable<int> equatable =
                from score in scores
                where score > 80
                select score;
            foreach (int i in equatable)
            {
                Console.WriteLine(i + " ");
            }

            using (SqliteConnection connection = new SqliteConnection())
            {
                connection.ConnectionString = @"Data Source=.\CenterData.db;";
                connection.Open();
                using (SqliteCommand command = connection.CreateCommand())
                {
                    if (true)
                    {
                        SqliteParameter[] parameters = {
                        new SqliteParameter("@IMG_ID", SqliteType.Integer,4),
                        new SqliteParameter("@USER_ID", SqliteType.Text),
                        new SqliteParameter("@FOLDER_ID", SqliteType.Integer,4),
                        new SqliteParameter("@STATU_ID", SqliteType.Integer,4),
                        new SqliteParameter("@WORK_TIME", SqliteType.Text),
                        new SqliteParameter("@START_TIME", SqliteType.Text),
                        new SqliteParameter("@END_TIME", SqliteType.Text),
                        new SqliteParameter("@OUTPUT_STATUS", SqliteType.Integer,4),
                        new SqliteParameter("@INPUT_DATA", SqliteType.Text),
                        new SqliteParameter("@INPUT_STATES", SqliteType.Integer,4),
                        new SqliteParameter("@FORMAT_NAME", SqliteType.Text)};
                        command.Parameters.AddRange(parameters);
                        //command.ExecuteNonQuery();
                    }
                    else
                    {
                        command.CommandText = "select * from runpara;";
                        command.CommandType = CommandType.Text;
                        using (SqliteDataReader dataReader = command.ExecuteReader(CommandBehavior.CloseConnection))
                        {
                            while (dataReader.Read())
                            {
                                string a = dataReader[0].ToString();
                                string b = dataReader[1].ToString();
                            }
                        }
                    }
                }
            }
        }
    }
}
 

发表评论