Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 24th, 2008, 04:12 PM
Authorized User
 
Join Date: Jul 2007
Location: Denver, CO, USA.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating a new process to install SQL Server Exp

Hi,

I'm working on deploying our application written in VB 2008. Our app's backend is a SQL Server Express 2005 DB.

I have found a white paper titled: "Embedding SQL Server Express into Custom Applications", written by Robert Walters for MS SQL Server 2005.

In this white paper, they have included sample code for writing a wrapper to deploy SQL Server Express 2005. However, the sample code is written in C#. I have not used C# until now. I was able to get the code compiled, but with the exception of one last error. The error is in one part of the code where we want to instantiate a new system process. The line of code below:

Process myProcess = new Process();

It looks perfectly fine to me. However, the compiler is saying:

"Error 1 The type or namespace name 'Process' could not be found (are you missing a using directive or an assembly reference?)..."

I have spent over an hour googling the web and also checking out MSDN. All code examples provided seem to be using the System.Diagnostic namespace. I tried to put in the same reference at the beginning of the block of code, but the compiler is still not happy.

Apologies if this thread is a repeat, but I could not seem to be able to find an answer to the problem yet.

Thank you very much for all your help.

Khoi Nguyen
__________________
Khoi Nguyen
Reply With Quote
  #2 (permalink)  
Old July 24th, 2008, 04:55 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Strange.... The Process class is indeed located in the System.Diagnostics namespace (notice the s in Diagnostics; not sure that's a typo in your post). This class is located in the System.dll assembly which should be included in your project by default.

What kind of application is this?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #3 (permalink)  
Old July 24th, 2008, 05:09 PM
Authorized User
 
Join Date: Jul 2007
Location: Denver, CO, USA.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Sorry, it was just a typo in my post. I checked my code again and indeed it has System.Diagnostics. Everywhere that I found , they all say the same thing which is that the Process class is defined in System.Diagnostics.

This C# program contains a simple class to detect whether SQL Server Express 2005 has been installed on a machine. If it already exists then no installation is needed. Otherwise, proceed with installing SQL Server Express 2005.

I got the sample code from the white paper that I mentioned for deploying SQL Server Express with a custom app.

Any thoughts?

Quote:
quote:Originally posted by Imar
 Strange.... The Process class is indeed located in the System.Diagnostics namespace (notice the s in Diagnostics; not sure that's a typo in your post). This class is located in the System.dll assembly which should be included in your project by default.

What kind of application is this?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Khoi Nguyen
Reply With Quote
  #4 (permalink)  
Old July 24th, 2008, 05:12 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Do you have a reference to System.dll in your project?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote
  #5 (permalink)  
Old July 24th, 2008, 05:35 PM
Authorized User
 
Join Date: Jul 2007
Location: Denver, CO, USA.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Apologies, the answer to your question is No. It turns out that I did not have System.dll added in as a reference. I thought that by doing "using System" at the beginning of my code is essentially the same thing, but as it turns out, I had to do Project > Add Reference and then select System from the list for it to work!

Thanks for your help.

Quote:
quote:Originally posted by Imar
 Do you have a reference to System.dll in your project?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Khoi Nguyen
Reply With Quote
  #6 (permalink)  
Old July 25th, 2008, 03:24 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Yes, something to be aware of there is that there is not a one to one relationship between namespace and referenced DLL. Most (but probably not all) of the System namespace is actually in the MSCORLIB.DLL, while other parts are no doubt in the System.dll assembly.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to install SQL Server 2005 muellmk SQL Server 2005 0 October 8th, 2007 07:33 AM
Install Sql Server 2000 in network kau_shuk SQL Server 2000 1 April 11th, 2007 07:20 AM
install database on SQL Server decap_itate Pro VB 6 2 October 1st, 2006 06:31 PM
Registration Process for Sql Server 2000 tiyyob SQL Server 2000 3 May 9th, 2006 06:05 PM
install database on SQL Server decap_itate VB Databases Basics 0 May 2nd, 2006 10:02 AM



All times are GMT -4. The time now is 12:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.