C# 如何使用asp.net c应用程序将MySql数据库转换为MsSQL数据库
我正在将一个网站转换成一个新的CMS,但是德国的网站数据库都是MySQL数据库,但是CMS是通过SQLServer工作的。因此,我必须进行数据库转换,我已经完成了一个psuedo代码,并使用microsoft visual studio启动了c程序,但由于我只在cms中使用了asp.net格式的c,这是我第一次真正的c编程尝试,因此请原谅我的代码中可能已经出现的一些可怕错误,即使没有我错过的部分 n、 b.我知道数据库在某些表方面有不同的名称,例如数据和时间,但数据库中没有会导致冲突的名称 伪:C# 如何使用asp.net c应用程序将MySql数据库转换为MsSQL数据库,c#,asp.net,mysql,sql-server,C#,Asp.net,Mysql,Sql Server,我正在将一个网站转换成一个新的CMS,但是德国的网站数据库都是MySQL数据库,但是CMS是通过SQLServer工作的。因此,我必须进行数据库转换,我已经完成了一个psuedo代码,并使用microsoft visual studio启动了c程序,但由于我只在cms中使用了asp.net格式的c,这是我第一次真正的c编程尝试,因此请原谅我的代码中可能已经出现的一些可怕错误,即使没有我错过的部分 n、 b.我知道数据库在某些表方面有不同的名称,例如数据和时间,但数据库中没有会导致冲突的名称 伪:
/*start loop
*connect to MYSQL
* is there a table to use? if yes begin loop, else Exit, & disconnect from MYSQL;
* begin iteration on Table N
* Read table list
SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
where Table_name ='Current selected table'
* execute
* Disconnect from MYSQL
*
* Connect to MS SQL
* create new table in MS SQL USing read data
* Create Table [same name as other table, with columns from other place]
* (all column names in here,sfg, bgfgb,dgb)
* ececute command, creating a new table
* Disconnect from MSSQL
*
* Connect to MySQl
* return all data within table n,
*
* Select * From [table name];
* Disconnect MySQL
*
* Connect MS SQL
* INSERT INTO (table name)
* VALUES ( columsn 1, 2, 3, 4 etc)
*
* execute
* Disconnect MS SQL,
*
* Table N +1 //next itteration
*
* insert into new table Values (data from mySQL)
* once all have been complete loop until ended
* program will leave when no tables left
*/
到目前为止,这是我用c语言创建的:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using MySql.Data.MySqlClient;
using System.Configuration;
namespace dbconverter
{
public class program
{
public static void Main(string[] args)
{
MySqlDataAdapter _Myadp = new MySqlDataAdapter();
int i = 0; i < _Table.Count; i++;
}
public static void ConnectMySQL()
{
string cs = @"MYSQLconnectionstring";
MySqlConnection conn = null;
try
{
conn = new MySqlConnection(cs);
conn.Open();
if (conn == null)
{
Console.WriteLine("connection could not be established");
}
else
{
Console.WriteLine("connection was successful");
}
}
}
public static void SearchTables()
{
MySqlDataAdapter _Myadp = new MySqlDataAdapter();
_Myadp.SelectCommand.CommandText = "show tables;";
}
public static void ChooseTable()
{
//Show all tables,
//have loop internal of main()
}
public static void CopyTable()
{
MySqlDataAdapter _Myadp = new MySqlDataAdapter();
_Myadp.Fill(_Table);
}
public static void connectMsSQL()
{
SqlConnection _con = new SqlConnection(ConfigurationManager.ConnectionStrings["MSconnectionstring"].ConnectionString);
_con.Open();
}
public static void CreateTable()
{
if (_Table != null)
{
if (_Table.Rows.Count > 0)
{
_return= new List<>();
for (int a = 0; a< _Table.Count; a++)
{
_return.Add(new_Table());
_Return[a].List<> = Convert.ToString(_table[int][" *-(ALL) "]);
}
}
}
}
public static void CopyMySQLTableData()
{
MySqlDataAdapter _Myadp = new MySqlDataAdapter();
_Myadp.SelectCommand.CommandText = "SELECT (*) FROM [_Table];";
//return to table
}
public static void InsertDataMsSQL()
{
if (_Table != null)
{
if (_Table.Rows.Count > 0)
{
_return= new List<>();
for (int a = 0; a< _Table.Count; a++)
{
_return.Add(new_Table());
_Return[a].List<> = Convert.ToString(_table[int][" *-(ALL) "]);
}
}
}
}
}
}
如果有人有时间,我基本上需要一些关于我现在如何处理我创建的类的建议,以使[Main class]能够按照伪结构将它们组合成一个工作程序
非常感谢您这是什么。。?int i=0;i<\u Table.Count;i++;这是一个for循环吗。。?这不是你做for循环的方式,如果它是。。!对不起,这是对我的新表[_table]的引用,但我不确定它应该放在哪里。forloop是我应该放在主课上的正确的东西吗?伪代码是否采取了正确的逻辑步骤?对不起,我对编程概念很陌生,而且我在学习的过程中也在不断学习。