Solved

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

Posted on 2008-10-07
5
322 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with exporting to excel 4 35
VB.NET 2008 Publish Error 2 32
Calculate number of nights between two dates 5 53
VB.net capture  result of a SQL query in variables 3 20
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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 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