|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Connections String QuestionsHi all Sorry for repeating my previous posting. I am new to VB Net. Q1. Which provider should be preferred when defining a connection, Data provider for SQL server or Data provider for OLEDB. I intend to use SQL Express 2005. Q2. I have a database on my local PC (SQL Server Express) and the same database on a remote PC. I built a simple form with a grid. Now I want to define the connection string in such a way that I am able to use any one of the above two by changing the connection string definition on one place. How do I go about this. Thank you in advance. Mike TI As far as Q1 - always use SqlClient with a SQL Server or SQL Express
database. You can supply connection strings in a variety of ways. I'd search the Help on connection strings to see what best suits your application. -Mary Show quote On Wed, 31 Oct 2007 04:53:29 -0800, "Mike TI" <tanv***@creativepk.com> wrote: >Oct 31, 2007 > >Hi all > >Sorry for repeating my previous posting. I am new to VB Net. > >Q1. Which provider should be preferred when defining a connection, Data >provider for SQL server or Data provider for OLEDB. I intend to use SQL >Express 2005. > >Q2. I have a database on my local PC (SQL Server Express) and the same >database on a remote PC. I built a simple form with a grid. Now I want to >define the connection string in such a way that I am able to use any one of >the above two by changing the connection string definition on one place. > >How do I go about this. > >Thank you in advance. > >Mike TI > Q1) Use the SQL Server Provider.
Q2) Depends on your needs. There's really no "best" method for this. I currently have apps that use App.Config, web sites that use Web.Config apps that use a custom xml configuration files and a whole series of apps that store the last 10 connection strings in the registry. It all depends on the nature of your app. A connection string is just a string. In terms of storing it and handing it around your app it's really no different from any other string variable. That being the case, you can store it literally anywhere else you might choose to store a string. Show quote "Mike TI" wrote: > Oct 31, 2007 > > Hi all > > Sorry for repeating my previous posting. I am new to VB Net. > > Q1. Which provider should be preferred when defining a connection, Data > provider for SQL server or Data provider for OLEDB. I intend to use SQL > Express 2005. > > Q2. I have a database on my local PC (SQL Server Express) and the same > database on a remote PC. I built a simple form with a grid. Now I want to > define the connection string in such a way that I am able to use any one of > the above two by changing the connection string definition on one place. > > How do I go about this. > > Thank you in advance. > > Mike TI > > > |
|||||||||||||||||||||||