Dynamically sql connection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Caba
    New Member
    • Jan 2011
    • 1

    #1

    Dynamically sql connection

    hi i`m using visual basic express 2010 and SQL server 2008 R2 this is my problem i create database in sql, then i connect to database by visual basic. like

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <configSections></configSections>
      <connectionStrings>
        <add name="WindowsApplication1.My.MySettings.BPdataConnectionString"
          connectionString="Data Source=.\SQLBAC;AttachDbFilename=G:\SQLSERVER\MSSQL10_50.SQLBAC\MSSQL\DATA\BPdata.mdf;Persist Security Info=True;User ID=sa;Password=martin;Connect Timeout=30;User Instance=False"
          providerName="System.Data.SqlClient" />
        <add name="BPdataEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLBAC;AttachDbFilename=G:\SQLSERVER\MSSQL10_50.SQLBAC\MSSQL\DATA\BPdata.mdf;Persist Security Info=True;User ID=sa;Password=martin;Connect Timeout=30;User Instance=False;MultipleActiveResultSets=True&quot;"
          providerName="System.Data.EntityClient" />
    everything is working but if i will use it in other PC then database directory and SQL server name will be different... so i need to ask program before start for server name, database name...
Working...