How can I specify the Server of my database when I make my project executable
I have this module I call everytime i modify my database
Public Sub main()
constr = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:"database file".mdf;" & _
"Integrated Security=True;Connect Timeout=30;User Instance=True"
Con = New SqlConnection(constr)
Try
Con.Open()
'MsgBox("Server Connection is Open ! ")
'frmMain.Connection.Text = "Connecting To serv``er"
Con.Close()
Catch ex As Exception
MsgBox("Sorry Can not open connection ! ", vbCritical, "Database")
End Try
End Sub
MY project will be installed on several computers. The database in integrated in my project
since i used Service-Based Database. Meaning when i copy the project to different computers,
the database always comes with it.
I'm thinking that when I will make an executable project, the database will be included.
How will I change the datasource above during installation of my project just to ensure that
there will be a single server for my database?
Thanks
Lethugs 8 Posting Whiz in Training
Recommended Answers
Jump to PostFor your "Service Based Database", you are using MSSQL?
Jump to Posthow will i change that connection/datasource as what the user wants?
I thought you did not want them to be able to change the DataSource.
If you need to allow them to select a server, maybe this will work for you?
Dim csb As …
Jump to PostThe code I posted showed you a way to retrieve the available instances of SQL Server within the local network [System.Data.Sql.SqlDataSourceEnumerator.Instance.GetDataSources()].
Where you place the code is up to you to decide.
Personally, I would make the user select a server on the first time execution of the program and …
Jump to PostCurious is not the word I use when that happens!
LOL. And just what may the word you use be?
All 15 Replies
john.knapp 25 Posting Whiz in Training
Lethugs 8 Posting Whiz in Training
john.knapp 25 Posting Whiz in Training
Lethugs 8 Posting Whiz in Training
TnTinMN 418 Practically a Master Poster
john.knapp commented: <snippet>nice!</snippet> +3
Lethugs 8 Posting Whiz in Training
TnTinMN 418 Practically a Master Poster
john.knapp 25 Posting Whiz in Training
TnTinMN 418 Practically a Master Poster
john.knapp 25 Posting Whiz in Training
Lethugs 8 Posting Whiz in Training
Lethugs 8 Posting Whiz in Training
Lethugs 8 Posting Whiz in Training
john.knapp 25 Posting Whiz in Training
john.knapp 25 Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.