简体   繁体   English

DevExpress Winforms XtraGrid和SQLite绑定数据库,插入行的最佳方法?

[英]DevExpress Winforms XtraGrid and SQLite bound database, best way to insert rows?

I have successfully bound a SQLite database table to a DevExpress XtraGrid control, and can see the few test rows I have, and can also edit the values, and commit the changes back to the database with an Update command upon closing. 我已经成功地将SQLite数据库表绑定到DevExpress XtraGrid控件,可以看到我拥有的几个测试行,还可以编辑值,并在关闭时使用Update命令将更改提交回数据库。

My question is what would be the best way for me to insert rows to the table? 我的问题是对表插入行的最佳方法是什么? I have implemented and successfully used some example code for inserting rows into a SQLite table, however I am uncertain if the DevExpress XtraGrid has some type of method to allow me to skip all of the example code I have, and simply use the same functionality that seems to be already built into the control. 我已经实现并成功地使用了一些示例代码来将行插入SQLite表中,但是我不确定DevExpress XtraGrid是否具有某种类型的方法来允许我跳过所有的示例代码,并且仅使用与似乎已经内置在控件中。

So should I use example code that connects to the database, builds the query then runs it on the database, or is there a better way, using something already built into the DevExpress WinForms suite? 因此,我应该使用示例代码来连接数据库,构建查询然后在数据库上运行它,还是有更好的方法,使用DevExpress WinForms套件中已经内置的东西?

Thanks. 谢谢。

You can use Embedded Navigator controls to insert rows ! 您可以使用Embedded Navigator控件插入行!

https://www.devexpress.com/Support/Center/Question/Details/Q235790 https://www.devexpress.com/Support/Center/Question/Details/Q235790

After some research, I found that the best way to interact with the data in the grid, or with any database for that matter, is to use DevExpress's eXpress Persistent Objects for .NET. 经过一番研究,我发现与网格中的数据或与此相关的任何数据库进行交互的最佳方法是使用DevExpress的.NET的eXpress持久对象。 Great bit of technology. 大量的技术。 It allowed me to specify the database and table I was interested in, and it created all of the plumbing to allow me to deal with rows in the table like normal C# objects with properties. 它允许我指定我感兴趣的数据库和表,并且它创建了所有管道以允许我像具有属性的普通C#对象一样处理表中的行。

If you are struggling with trying to mix in SQL queries and the like into your application, I highly recommend you make your life much easier and use XPO. 如果您在尝试将SQL查询之类的东西混入应用程序中而感到挣扎,我强烈建议您简化工作并使用XPO。

Here is a link to the documentation describing XPO: http://documentation.devexpress.com/#XPO/CustomDocument1998 这是描述XPO的文档的链接: http : //documentation.devexpress.com/#XPO/CustomDocument1998

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM