当前位置: 首页 > news >正文

html5 微网站模版自助搭建平台

html5 微网站模版,自助搭建平台,wordpress 手机版本,购物网站设计的目的1,一般的访问方式。 1.1,连接语句。 //sqlite 连接,支持相对位置,也支持绝对位置 Data Source../../Database/cater.db// 连接数据库,FailIfMissingfalse时若文件不存在会自动创建 string connStr "DataSourcetest.db;Vers…

1,一般的访问方式。

1.1,连接语句。
//sqlite 连接,支持相对位置,也支持绝对位置
Data Source=../../Database/cater.db// 连接数据库,FailIfMissing=false时若文件不存在会自动创建
string connStr ="DataSource=test.db;Version=3;Pooling=true;FailIfMissing=false;";
1.2,配置文件设置。
//需在配置文件中进行如下配置否则报错
<startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
 1.3,常用语法。
//语法:
select * from AlarmHistory
insert into alarmhistory (AlarmDetails,starttime) values ('abc',getdate())
//获取当前时间
select datetime('now')
SELECT datetime('now', 'localtime');
select CURRENT_TIMESTAMP//插入当前时间
insert into alarmhistory (alarmdetails,starttime) values('',datetime('now','localtime'))//查找为null的数据
select * from alarmhistory where StartTime is null//修改表格序号update sqlite_sequence set seq = 0 where name = 'AlarmHistory'//查询表格主键
select * from
pragma_table_info ('ActualData') where pk=1//查询表格是否存在
select exists(  select * from sqlite_master where type='table' and name='ActualData')//删除表格drop table 'ActualData' //获取和设置时间,时间格式只支持类似yyyy-MM-dd这样用-连接的格式,若用/连接则无效
select datetime('2024-08-22 16:23:55')
SELECT datetime('now', 'localtime');
1.4,SQLite访问dll。

https://download.csdn.net/download/lingxiao16888/89914696

2,基于EntityFramework的ORM数据访问。

2.1,安装Nuget包

这部分比较简单,直接Nuget包中下载即可

  1. System.Data.SQLite
  2. System.Data.SQLite.EF6
  3. System.Data.SQLite.LINQ
  4. SQLite.CodeFirst

2.2,配置文件需要进行如下修改。
<?xml version="1.0" encoding="utf-8"?>
<configuration><configSections><!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --><section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /></configSections><startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup><entityFramework><providers><provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /><provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /><provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /></providers></entityFramework><system.data><DbProviderFactories><remove invariant="System.Data.SQLite.EF6" /><add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" /><remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories></system.data>
</configuration>
2.3,应用。
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace ConsoleApp2
{class Program{static void Main(string[] args){MyDbContext context = new MyDbContext("cater.db");var set = context.Set<MemmberType>();var ss = set.FirstOrDefault();foreach (var item in set){Console.WriteLine($"{item.MemTpName} ; {item.MemType} ; {item.MemTpDesc} ; {item.SubBy} ;{item.DelFlag}");}Console.WriteLine("输出完成!");Console.ReadKey();}}class MyDbContext : DbContext{public MyDbContext(string constr) : base(new SQLiteConnection{ConnectionString = new SQLiteConnectionStringBuilder{DataSource = constr,ForeignKeys = true}.ConnectionString}, true){}//如果查询 MemmberType 表,则该属性不能省略public virtual DbSet<MemmberType>  MemmberType { get; set; }}[Table("MemmberType")]//该特性不能省略class MemmberType{[Key]//如果存在主键该特性不能省略[Column("MemType",TypeName ="INT")]public int MemType { get; set; }//[Column("MemTpName")]public string MemTpName { get; set; }[Column("MemTpDesc")]//可使用 Required 特性指定该列不能为空public string MemTpDesc { get; set; }//[Column("DelFlag")]public int DelFlag { get; set; }//[Column("SubBy")]public int SubBy { get; set; }}
}
2.4,效果。

数据库文件数据。

查询结果。

http://www.zhongyajixie.com/news/7730.html

相关文章:

  • 做网站的图片=gifnba排名最新赛程
  • 陕西网站备案代理企业管理软件
  • 英德住房和城乡建设局网站百度目前的推广方法
  • 怎么做校园表白网站全网营销系统
  • wordpress被植入广告网络排名优化软件
  • 文网站建设广告制作公司
  • 制作网站的公司怎么样太原网站优化公司
  • 杭州兼职网站建设seo公司赚钱吗
  • 休闲小零食网站开发方案网页百度
  • 济南学习做网站如何创建一个app平台
  • 北京团建网站体验式营销案例
  • 做视频网站用哪个软件好郑州厉害的seo顾问
  • 淮安专业网站建设海口网站建设
  • 一家专门做母婴的网站网络服务器的作用
  • 哪个网站可以做危险化学品供求童程童美少儿编程怎样收费
  • 学校网站建设自查报告网上的推广公司
  • 浦东企业网站建设个人网站怎么做
  • 有保障的广州网站建设做网站多少钱一年
  • 大型网站怎么做优化阳山网站seo
  • wordpress 写文章空白优化搜索引擎营销
  • 网站后台选择成都计算机培训机构排名前十
  • 做电影网站还能赚钱百度关键字优化价格
  • 宁波网站公司哪家好免费引流推广方法
  • 做技术网站赚钱吗长沙快速排名优化
  • 公司转让注意事项西安seo网站排名
  • 烟台网站设计销售网站有哪些
  • 婚纱手机网站制作营销型网站建设需要多少钱
  • 成品网站怎么新建网页搜狗搜索网
  • 平邑网站建设广州seo代理
  • 上海专业网站建设网站微信广告怎么投放