Solved

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

Posted on 2008-10-07
5
319 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
Comment Utility
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
Comment Utility

>> 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
Comment Utility
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
Comment Utility
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
Comment Utility
>> 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

6 Experts available now in Live!

Get 1:1 Help Now