Sqlite For .Net

前端之家收集整理的这篇文章主要介绍了Sqlite For .Net前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
DbProviderFactory fact = DbProviderFactories.GetFactory("System.Data.sqlite");
        using (DbConnection conn = fact.CreateConnection())
        {
            conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["sqliteConnString"].ConnectionString;
            conn.Open();
            DbCommand comm = conn.CreateCommand();
            comm.CommandText = "select * from role";
            comm.CommandType = CommandType.Text;
            using (IDataReader reader = comm.ExecuteReader())
            {
                while (reader.Read())
                {
                    Response.Write(reader["rName"]);
                }
            }
        }


<connectionStrings>
		<add name="sqliteConnString" connectionString="Data Source=C:\ys_sqlite.db3;Pooling=true;FailIfMissing=false" providerName="System.Data.sqlite" />
	</connectionStrings>

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
    <requiredRuntime version="v4.0.20506" />
  </startup>




App.config or web.config 中,针对.net 不同版本需要加上

原文链接:https://www.f2er.com/sqlite/202364.html

猜你在找的Sqlite相关文章