备份mysql数据库并将其转换为sqlite以在c#中使用它

时间:2022-08-12 05:33:14

my project manager asked me to do the following:

我的项目经理让我做以下事情:

-backup data from mysql database that is on the server

来自服务器上的mysql数据库的-backup数据

-convert this data to sqlite

- 将此数据转换为sqlite

-add it to a windows form application that read from this sqlite new database

- 添加到从此sqlite新数据库读取的Windows窗体应用程序

the target is to keep part of the database always linked to this c# windows application

目标是保持数据库的一部分始终链接到此c#windows应用程序

I've read articles about backup data from mysql using c# and I don't expect to have problems

我用c#读过有关mysql备份数据的文章,我不希望有问题

backup using mysqldump.exe 1

使用mysqldump.exe进行备份1

backup using mysqldump.exe 2

使用mysqldump.exe备份2

backup using mysqldump.exe 3

使用mysqldump.exe备份3

How can I convert this mysql dump file into sqlite and load the data to the c# using the sqlite memory and then save it so the application will use this sqlite database each time it runs. All of these steps must be done by the c# windows application itself with a button or something similar.

如何将此mysql转储文件转换为sqlite并使用sqlite内存将数据加载到c#然后保存,以便应用程序每次运行时都将使用此sqlite数据库。所有这些步骤必须由c#windows应用程序本身使用按钮或类似的东西完成。

1 个解决方案

#1


0  

IMO easiest way to do this, and how we do it: export the tables as CSV. Open them in excel. create an insert statement for the first row in the excel sheet using variables for the cells, append that as an extra column. click and drag that down to repeat that statement on every row.

IMO最简单的方法,以及我们如何做到这一点:将表格导出为CSV格式。在excel中打开它们。使用单元格的变量为Excel工作表中的第一行创建插入语句,将其作为额外列附加。单击并向下拖动以在每一行上重复该语句。

Copy that generated column, and bring it into your sqlite database browser, and run that huge statement.

复制该生成的列,并将其带入您的sqlite数据库浏览器,并运行该巨大的语句。

the statement should look like : ="INSERT INTO newTable VALUES('" &A2&"','" &B2&"');"

该陈述应如下所示:=“INSERT INTO newTable VALUES('"&A2&”','“&B2&”');“

don't make it any harder then it should be :P

不要让它变得更难,那应该是:P

#1


0  

IMO easiest way to do this, and how we do it: export the tables as CSV. Open them in excel. create an insert statement for the first row in the excel sheet using variables for the cells, append that as an extra column. click and drag that down to repeat that statement on every row.

IMO最简单的方法,以及我们如何做到这一点:将表格导出为CSV格式。在excel中打开它们。使用单元格的变量为Excel工作表中的第一行创建插入语句,将其作为额外列附加。单击并向下拖动以在每一行上重复该语句。

Copy that generated column, and bring it into your sqlite database browser, and run that huge statement.

复制该生成的列,并将其带入您的sqlite数据库浏览器,并运行该巨大的语句。

the statement should look like : ="INSERT INTO newTable VALUES('" &A2&"','" &B2&"');"

该陈述应如下所示:=“INSERT INTO newTable VALUES('"&A2&”','“&B2&”');“

don't make it any harder then it should be :P

不要让它变得更难,那应该是:P