编写SQLite数据库脚本

编程入门 行业动态 更新时间:2024-10-15 08:23:16
本文介绍了编写SQLite数据库脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在生成Schema.sql文件,我想以编程方式创建sqllite db文件并从该文件中执行所有sql语句.

I'm generating Schema.sql file and I want programatically to create sqllite db file and execute all sql statements from file.

谢谢

推荐答案

您可以使用SchemaExport类生成脚本,和/或将其应用于数据库: nhibernate.info/doc/tutorials/first-nh-app/your-first- nhibernate-based-application.html

You can use the SchemaExport class to generate the scripts, and/or apply them to the database : nhibernate.info/doc/tutorials/first-nh-app/your-first-nhibernate-based-application.html

public class GenerateSchema_Fixture { [Test] public void Can_generate_schema() { var cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly(typeof (Product).Assembly); new SchemaExport(cfg).Execute(true /*script*/, true /*export to db*/, false /*just drop*/, true /*format schema*/); } }

更多推荐

编写SQLite数据库脚本

本文发布于:2023-07-15 12:59:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1111371.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   数据库   SQLite

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!