Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
MyProject is developed in Vb and Mysql server but now i need to change my project Msql to Sql what can i do?

What I have tried:

I am new to vb and mysql so any one can help me?
Posted
Updated 27-Aug-18 20:23pm
Comments
Er. Puneet Goel 28-Aug-18 1:57am    
You basically need to import all data from MYSQL to SQL. rights?
[no name] 28-Aug-18 2:02am    
yes..I want to change db and coding to sql
Er. Puneet Goel 28-Aug-18 2:08am    
Then I recommend you to look for the option to import data from MySql To SQL Server. SSIS package can do the same. Also, SQL Server Import Export functionality can do this as well.
[no name] 28-Aug-18 2:15am    
ok sir..Now how can i add the sql reference in visual studio 2005.
Er. Puneet Goel 28-Aug-18 2:21am    
Please accept the solution first then we can proceed.

I recommend you to look for the option to import data from MySql To SQL Server. SSIS package can do the same. Also, SQL Server Import Export functionality can do this as well.
 
Share this answer
 
Comments
Er. Puneet Goel 28-Aug-18 2:22am    
You can use Ado.Net for sql Linking.
Start by transfering your data: Converting MySQL Databases (MySQLToSQL) | Microsoft Docs[^] shoudl help.

THen your code: this will depend on how well (or how badly) you have written the code, and how many MySql specific features you have used.

Change the classes from MySqlConnection, MySqlCommand, and forth to their SQL Server equivalents: SqlConnection. SqlCommand, and so on.
Then look at your commands themselves: if you concatenate strigns to build your SQL commands:
VB
Dim strCommand As String = "SELECT * FROM MyTable WHERE CustName = '" & tbCustName.Text & "'"
Then the conversion will be easier, but your code is vulnerable to SQL Injection so you need to make extensive changes to your app to parameterise all queries.
If your code uses "?" parameter place markers instead:
VB
Dim strCommand As String = "SELECT * FROM MyTable WHERE CustName = ?"
Then you need to replace that with named parameters:
VB
Dim strCommand As String = "SELECT * FROM MyTable WHERE CustName = @CN"
And alter the names in the Parameters collection of the appropriate SqlCommand objects.

After that, test, test test - we can have no idea what MySql features you have used, so it's a case of identifying where the code fails, and replacing each feature one by one.

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900