Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Newbie deploying VB.net / SQLExpress app

Posted on 2007-03-23
2
903 Views
Last Modified: 2010-05-18
Hi Experts,
I developed an app using VB.net and SQLExpress. Now, I need to deploy my application. I have a few questions:

1) When the application is first installed on a server, how do I make SQLExpress attach the database
2) On client machine, I need to modify the connection strings in the config to point to the server. How do I determine the server's name?
3) Should I create two installer?? One for server and one for client machine?
4) If after installing the app on the server, how do I make changes to the db (ie add/delete  table, columns etc..)??
0
Comment
Question by:noobe1
2 Comments
 
LVL 42

Accepted Solution

by:
dqmq earned 500 total points
ID: 18778118
1. Run CREATE DATABASE ... FOR ATTACH
2. You can't determine it from the client. The name is determined during installation of SQL Server. However, \\NetworkName\.\SQLExpress finds the default database
3. Probably
4. Generally speaking, you would do that kind of work in a development environment, not on the production server.  When all has been tested, then you either reinstall or upgrade. Either way, for most changes of that nature you would need to take the app out of service and coordinate the database changes with the application changes.
0
 

Author Comment

by:noobe1
ID: 18784432
I created the following script with SQL Server Management Studio:

USE [master]
GO
CREATE DATABASE [RESUMEDB] ON
( FILENAME = N'C:\Program Files\XYZ\TestDB.mdf' ),
( FILENAME = N'C:\Program Files\XYZ\TestDB_log.ldf' )
 FOR ATTACH
GO
if not exists (select name from master.sys.databases sd where name = N'TESTDB' and SUSER_SNAME(sd.owner_sid) = SUSER_SNAME() ) EXEC [TESTDB].dbo.sp_changedbowner @loginame=N'HPZE4100\p', @map=false
GO

How do I make VB.net execute the script after installation is complete?
Thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

829 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