Solved

Converting VB 2008 project that uses Access (OleDB) to Sql

Posted on 2008-10-07
5
320 Views
Last Modified: 2012-06-21
What is the best way to modify a [fairly large] VB 2008 project which connects to an Access database via OleDb to connect to an SQL Server 2008 Express (via SqlCllient) database instead? I tried doing a find-and-replace throughout the entire project from ".OleDb" to ".Sql" and from "OleDb." to "SqlClient.", but it didnt work :) HUNDREDS of errors!!! Is there an easy way of doing this or am I going to have to rewrite the entire application? There a re a few thousand lines of code over about 60 forms :(
0
Comment
Question by:SETP
  • 2
  • 2
5 Comments
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 250 total points
ID: 22659609
Mmmm... for that reason is highly recommended to use layer architecture when designing & programming... if your data access code would be written & coded only in one layer (class library project), you'll only need to do the changes there without modifying any other code... So I recommend to you strongly use this approach in your future developments.
0
 
LVL 48

Assisted Solution

by:jpaulino
jpaulino earned 250 total points
ID: 22659856

>> HUNDREDS of errors!!!
Did you select in the find-and-replace window to work on hidden text also ? It's normal to give some errors but not too many ... or you have used the wizards to fill some controls ?
0
 
LVL 25

Assisted Solution

by:Luis Pérez
Luis Pérez earned 250 total points
ID: 22659948
Also, there is an additional problem. How are you accesing the data in MS Access database? Via Queries, or directly with SQL written in your source code? Note that SQL syntax is different between MS Access SQL and Transact SQL of SQL Server.
0
 

Author Comment

by:SETP
ID: 22660247
Thanks for all the replies. jpaulino, yes I did select to work on hidden text. RolandDeschain, in some parts I access the data via SQL queries (executing an OleDbCommand connected to an OleDbConnection). Other places I simply drag-and-dropped a table from Visual Studio's "Data Sources" window onto the form. This automatically created a DataGridView with a TableAdapters and BindingSources. The DatagGridView is database-agnostic, but I'm not so sure about the other two. I'm beginning to think I might have to rewrite the whole damn thing :(
0
 
LVL 48

Assisted Solution

by:jpaulino
jpaulino earned 250 total points
ID: 22660319
>> Other places I simply drag-and-dropped a table from Visual Studio's "Data Sources" window onto the form.
I have used the wizards !!! This way you have to change it manually. I suggest that you don't use it again and do that in the code.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now