![]() |
![]() |
|||
|
||||
|
|||||||
| Register | Forum Rules | FAQ | Search | Today's Posts | Mark Forums Read |
| Welcome Guest Visitor! Please Register, It's Free and Fun To Participate! | |
|
The EXTREME Overclocking Forums are a place for people to learn how to overclock and tweak their PC's components like the CPU, memory (RAM), or video card in order to gain the maximum performance out of their system. There are lots of discussions about new processors, graphics cards, cooling products, power supplies, cases, and so much more!
You are currently viewing our boards as a "guest" which gives you limited access to view most discussions. You need to register before you can post: click the register link to proceed. Before you register, please read the forum rules. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own pictures, and access many other special features. Registration is fast, simple, and absolutely free! To start viewing messages, select the forum that you want to visit from the selection below. After you have registered and read the forum rules, you can check out the FAQ for more information on using the forum. We hope you enjoy your stay here! Note To Spammers: We do not allow unsolicited advertising! Spam is usually reported & deleted within minutes of it being posted, so don't waste your time (or ours)! |
|
| Please Register to Post a Reply |
|
|
Thread Tools |
|
|
#1 | ||||
|
Meth Santa!
Senior Member
|
GUIDE: Setup VS C# 2008 Express and SQL Server 2008 Express, so it actually works.
NOTE: The files mentioned in this setup are for Vista Business x86. Be sure to download the correct version of the files for your version of Vista. WHY THIS GUIDE? As I use C# and SQL daily at work, I thought it would be nice to have a rig at home that I can test stuff on when ideas pop into my head or when I need to work out a problem with some code. Not wanting to spend money unnecessarily, I thought I'd try MS's free version of their development packages, namely the Express versions. During install I found myself going back and forth to the net trying to find solutions to some of the problems I was encountering. However, what I found was a lack of step by step guides on the net to get these apps not only running but able to talk to one another. In an effort to help those who may wish to tinker with a similar setup, I made this guide to fill the void. I have included links to the files needed to do this installation and they were valid at the time I wrote this guide, however if links do become broken please tell me so I may fix them. THE SOFTWARE The first step is to decide on which flavour of Visual Studio you would like to work with. In this guide, I will be using VS C# 2008 Express. Program: Visual Studio C# 2008 Express Location: http://www.microsoft.com/express/download/#webInstall File Name: vcssetup.exe Remarks: There are four flavours of VS 2008 Express, C++, C#, Visual Basic and Web Developer. You can download each Express edition individually or if you scroll to the bottom of the page, you can select the Offline .iso. This will give you all four Visual Studio Products in an iso that you can use to make a DVD. The install is straightforward so I will not spend time on it except to mention that you need to select the SQL Server 2008 option during the setup. Program: SQL Server 2008 Express with Advanced Services Location: http://www.microsoft.com/express/sql/download/ File Name: SQLEXPRADV_x86_ENU.exe Remarks: Be sure to check out the Hardware and Software requirements at http://msdn.microsoft.com/en-us/library/ms143506.aspx and to verify the following Prerequisites:
Location: http://www.microsoft.com/downloads/d...DisplayLang=en File name: dotNetFx35setup.exe Program: Microsoft Data Access Components (MDAC) 2.8 SP1 Location: http://www.microsoft.com/downloads/d...displaylang=en File name: MDAC_TYP.EXE Remark: Even though this is listed as a prerequisite by MS, Vista already has MDAC installed so it is not needed. I have included this link so XP users needing this file have something to work with. Program: Windows Installer 4.5 Location: http://www.microsoft.com/downloads/d...ng=en#filelist File name: Windows6.0-KB942288-v2-x86.msu Remarks: If you get the error message "The update does not apply to your system", check under Installed Updates in Programs and Features for the presence of Hotfix for Microsoft Windows KB942288. Apparently, the error message is meant to imply that the Hotfix has already been installed. No confusion there now is there. :/ If you check out this page from MS http://support.microsoft.com/kb/941720/en-us, near the bottom it explains how it can happen. Quote:
Program: Windows PowerShell Location: http://www.microsoft.com/windowsserv.../download.mspx File name: Windows6.0-KB928439-x86.msu Program: Windows SQL Server 2008 Express with Advanced Services Location:http://www.microsoft.com/express/sql/download/ File name: SQLEXPRADV_x86_ENU.exe Remarks: Here are the installation steps I took to successfully install SQL Server 2008 Express THE SETUP
ERRORS YOU MAY ENCOUNTER DURING SETUP. When errors are encountered, I found that the best thing to do is to totally uninstall the SQL package and start over again. It will just save you time in the long run. -My Services failed to install. So now what?! You can check the Log file that is listed at the top of the Final Page but it will not tell you much except that you need to investigate the failure, uninstall the SQL Server fix the problems then reinstall. I did a quick search on the Internet and found that if a previous version was installed and that the directories were not removed after uninstallation then it will cause a failure. Therefore, I uninstalled, purged the old directories and restarted the computer. I then ran CCleaner, sure enough, the registry contained many orphaned entries for SQL Server, and so I fixed those. I also purged the temp files and such, then rebooted again just to be safe. Error Example -On my second attempt, I received only one error, Input String was not in the Correct Format for Reporting Services. Turns out my Performance Counters were corrupted :/ To fix this, open a Command Prompt using the Run As Administrator option (this is another tidbit I discovered that isn't mentioned anywhere I could find and the following command will fail if you don't run it with Administrative rights). Type in "lodctr /R". This will rebuild the Performance Counters TESTING If you've arrived at this point, you should now have a working setup of VS C# 2008 Express and SQL Server 2008 Express. Let's test the connection to see if it works. First, launch the Microsoft SQL Server Management Studio. This is where you'll see if you setup the Datbase Engine Configuration correctly. On the login popup, leave everything at it's default values and click Connect. You should now see a visual representation of your SQL server. In the left-most pane, expand Databases. Right click on Databases and select New Database. In Database Name, enter a name. I called it Test. Then click OK. We now need to add permissions so users can access tha database. Right click on the newly created database and select Properties. Click on Permsissions then click on the Search button. Add the user you want to have access to the database then set the permissions for that users. Expand your database then right click on Tables and select New Table. A table should appear in Design view. Enter 3 columns, one called CustomerID with an Int datatype, another called NameLast with a varchar(50) datatype and a final one called NameFirst also with a varchar(50) datatype. Go back to the CustomerID column and uncheck Allow Nulls. Go to your Column Properties, expand Identity Specification and change Is Identity from No to Yes. This will cause all new entries to auto increment by 1 and you can then use this as your Primary Key. Right click on the CustomerID column and select Set Primary Key. This ensures that every new record entered with always be unique. Right click on the Table's tab and select Save. Save it as Customers. Right click on your new table and select Edit Top 200 Rows. Enter a couple of make believe customers. You'll notice that you cannot enter the CustomerID, that's because it will be set by the database. You'll also notic ethat you don't have to Save your entries as they are saved automatically when a new record is entered. Launch VS C# 2008 Express and create a new Console Project. For the sake of this test, we'll create a small console app that will pull info from the Test database and display it. Make sure you use the SQLClient (the line in bold) Code: Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
namespace Test
{
class Program
{
static void Main(string[] args)
{
//Setup the connection string.
string connectionString = "Data Source=your server name\\SQLExpress;Database=Test;Trusted_Connection=True";
//Create a new SqlConnection and pass the connection string to it
SqlConnection sqlCon = new SqlConnection(connectionString);
//Open the connection
sqlCon.Open();
//Setup the query
string commandString = "SELECT * FROM Customers";
//Create a new command tp pass the command string to the connection
SqlCommand sqlCmd = new SqlCommand(commandString, sqlCon);
//Read the data
SqlDataReader dataReader = sqlCmd.ExecuteReader();
//Cycle through the data
while (dataReader.Read())
{
Console.WriteLine(String.Format("{0} {1} {2} ", dataReader["CustomerID"], dataReader["NameLast"], dataReader["NameFirst"]));
}
//Close the connection
dataReader.Close();
sqlCon.Close();
}
}
}
Last edited by Mindwarp : 10-23-2008 at 08:22 PM. |
||||
|
|
|
|
#2 | ||||
|
Meth Santa!
Senior Member
|
Wow, 167 views and no comments
![]() Either alot of 'guest users' are using it and not commenting or it's a garbage guide.
|
||||
|
|
|
|
#3 | ||||
|
Running System Stock
Forum Newbie
Posts: 7
Last Seen: 08-26-2009
|
Hi MindWarp,
I have an easy question for you. That is I hope it's easy. Yesterday afternoon I was loading SQL Express 2008 on mydesktop and finally got it to load and wound up with that installation list box. Since it was quitting time I immediately closed shop and left work, but I forgot to note where and what name was the file that displayed that setup box for SQL 2008 Express. Can you help me please. I looked at Recent Items and couldn't find any reference to it there. Thanks if you can provide any help otherwise I will have to start the whole process again. |
||||
|
|
|
|
#4 | ||||
|
Meth Santa!
Senior Member
|
Hi JPM, I'd be glad to help. However I'm not quit sure I follow your question. Are you refering to the location of the ini configuration file that's listed on the install summary?
|
||||
|
|
|
|
#5 | ||||
|
Think Change.
Senior Member
|
Sorry Mindwarp! It was (is) a great looking guide. I would just be more interested in getting mysql++ or connector/++ working in Xcode or VS.
I plan on following your install guide in a month or so when I'm on break though! |
||||
|
|
|
|
#6 | ||||
|
Running System Stock
Forum Newbie
Posts: 7
Last Seen: 08-26-2009
|
Hi Mindwarp,
I reran the installation and saw that the Setup file was under the alphanumerical folder created only after you install the download. So it seems to delete itself after you shut down your computer. However I do have another question as today I was following your instructions on setting up SQL Express. When it comes to the Server Configuration box since I will be creating my software to access SQL Express under my account name and password, will Microsoft allow me to read/write to the database if I put in a different Account Name and Password in the Server Configuration boxes? |
||||
|
|
|
|
#7 | ||||
|
Meth Santa!
Senior Member
|
Quote:
Quote:
Quote:
Now then, if you go to START > ALL PROGRAMS > MICROSOFT SQL SERVER 2008 you will find an application called SQL Server Management Studio. This is the important component that I mentioned in the guide. It's a graphical interface that allows admins to manage the databases. Basically, this is where you set the access permissions. As in your case, since you have different accounts managing and accessing the db's, it's simply a case of assigning the user the desired roles. When you launch the app, a login screen appears. If you set your Windows account as part of the SQL server admins, you'll see your name listed and Windows Authentication selected, in which case you simply click Connect and Windows will provide the necessary credentials to access the server. If you select SQL Server Authentication during the login, you'll use the SA account and the password mentioned above. As long as the permissions are set, you can allow or deny access to different accounts to the db's. Keep in mind that assigning permissions can become a bit confusing in SQL. I'm still learning the correct methods for applying the permissions so I'm no expert!
|
||||
|
|
|
|
#8 | ||||
|
Running System Stock
Forum Newbie
Posts: 7
Last Seen: 08-26-2009
|
Thanks Mindwarp for the guidance. I have currently run into one error under Error and Usage Reporting which is that my version of VS 2008 is not the SP1 version. So after I install that I will tackle the rest of the installation and tomorrow check out what you said above in creating a small database and setting up permissions.
Oh by the way do you have C++/CLR version for creating the database you created in C# code above as I will be using C++? |
||||
|
|
|
|
#9 | ||||
|
Meth Santa!
Senior Member
|
I ran the C# code into a converter and this is the result. Since I am not proficient in C++, I have no clue weather the conversion is accurate or not. I hope it helps.
Code:
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Linq;
using namespace System::Text;
using namespace System::Data::SqlClient;
namespace Test
{
private ref class Program
{
static void Main(array<System::String^> ^args)
{
//Setup the connection string.
System::String ^connectionString = "Data Source=your server name\\SQLExpress;Database=Test;Trusted_Connection=True";
//Create a new SqlConnection and pass the connection string to it
SqlConnection ^sqlCon = gcnew SqlConnection(connectionString);
//Open the connection
sqlCon->Open();
//Setup the query
System::String ^commandString = "SELECT * FROM Customers";
//Create a new command tp pass the command string to the connection
SqlCommand ^sqlCmd = gcnew SqlCommand(commandString, sqlCon);
//Read the data
SqlDataReader ^dataReader = sqlCmd->ExecuteReader();
//Cycle through the data
while (dataReader->Read())
{
Console::WriteLine(System::String::Format("{0} {1} {2} ", dataReader["CustomerID"], dataReader["NameLast"], dataReader["NameFirst"]));
}
//Close the connection
dataReader->Close();
sqlCon->Close();
}
};
}
|
||||
|
|
|
|
#10 | ||||
|
Running System Stock
Forum Newbie
Posts: 7
Last Seen: 08-26-2009
|
Thanks again Mindwarp for the C# converted code to C++.
I opened the MS SQL Server Managerment Studio and kind of was overwhelmed when skimming over everything. I am use to using Access DB which was nice and simple to use, but SQL Server is much more complex. I will try that code you gave me and see what happens. Oh by the way again... can I get a copy of that converter code you have for C# to C++? I have been looking at all the example codes online and text online and most everything is written in C#. So that converter code would at least give me a shot in the right direction when using those samples. |
||||
|
|
|
|
#11 | ||||
|
Meth Santa!
Senior Member
|
I used a trial version of Instant C++, it works amazingly fast.
http://tangiblesoftwaresolutions.com...rp_Edition.htm |
||||
|
|
|
|
#12 | ||||
|
Learning To Overclock
Senior Member
|
Sorry, but I have VS 2008 Pro and SQL Server 2008 Dev installed.
Also, if you dont have it, this is the greatest .NET tool http://www.red-gate.com/products/reflector/ It will decompile just about any .NET code into any supported language. |
||||
|
|
|
|
#13 | ||||
|
Running System Stock
Forum Newbie
Posts: 7
Last Seen: 08-26-2009
|
Mindwarp,
Under your C++/C# code the setup connection string reads "Data Source= your server name\\SQLExpress;...." I put my computer name there (JPMsComputer) but the program can not find the source still. Do you have any suggestions? I can't find the database folder where "Test" exists. Is there an Test.mdf file? |
||||
|
|
|
|
#14 | ||||
|
Meth Santa!
Senior Member
|
The connection string in your case should be:
Quote:
If that still fails, try this: In the management studio, right click on the database and select New Query. In the pane type the following commands: Code:
exec sp_configure 'user instances enabled', 1 Code:
reconfigure You may have to restart the server to get it going. Last edited by Mindwarp : 10-25-2008 at 12:59 PM. |
||||
|
|
|
|
#15 | ||||
|
Running System Stock
Forum Newbie
Posts: 7
Last Seen: 08-26-2009
|
Mindwarp,
Did what you described above and still get error: "There is no source code available for the current location" even though the test.mdf exists in the path described above. Additional Comment: Mindwarp, Maybe because I partitioned Vista and SQL Express in my E: drive. ??? Last edited by JPM2008 : 10-24-2008 at 06:39 PM. Reason: Automerged Doublepost |
||||
|
|
|
|
#16 | ||||
|
Meth Santa!
Senior Member
|
Sounds like a reference problem. Try this: create a new project with a different name and recreate the code. Rebuild and test. Even though the code is the same, I think there is a problem with referencing after the access conditions were changed. I will have to investigatge this error, let ne know how it works out. As for partioning, if you can log into the SQL server then it's location is not a problem. I think it has more to do with changes to access after the initial creation.
|
||||
|
|
|
|
#17 | ||||
|
Learning To Overclock
Senior Member
|
You might try:
Code:
string connectionString = "Data Source=.\\SQLExpress;Initial Catalog=Test;Integrated Security=SSPI"; |
||||
|
|
|
|
#18 | ||||
|
Running System Stock
Forum Newbie
Posts: 7
Last Seen: 08-26-2009
|
Hi Mindwarp,
Found the root cause of the problem. It seems like microsoft moved the "Listener" from SQL Server 2000 to a dedicated "Listener" in SQL Server 2005 and I assume to 2008 also. That service is SQLBrowser. You can find "SQL Server Browser" under "SQL Server 2005 Service" in the SQL Service Configuration Manager and select "Automatic" to make the service "running". See "http:/blog.msdn.com/sqlexpress/archive/2004/07/23/192044.aspx" Additional Comment: Mindwarp, I am doing a little experiment with you code. I have a laptop that is network connected to my desktop that has SQL Server Express running. I took my source code and am running the application now in my laptop. I want to see if I can read the SQL database from another laptop or remote. I am running into an error which I knew would happen ... Error Locating Server/Instance Specified. Since I don't have SQL Server Express 2008 in my laptop I am wondering if the DIstributable would work. The error also states: Additional Comment: Disregard the last sentence because my wireless keyboard's batteries just died and I don't remember what I was going to say anyway. Additional Comment: Mindwarp, Do you know of any good books or online resources where I can program SQL Express using C#? I can use the converter program to translate to C++ if needed. I want to be able to create database, Tables, and write columns into the DB Tables as well as delete and copy records. I also of course need to populate the DB tables with data programmatically. Basically a book with good examples (and right syntax). I am also wondering if there is info on how to setup the SQL Server or the application I write to be able to communicate to another computer using Vista sharing instead of having the SQL Server express residing in a dedicated server. Any info would help. Thanks a lot. Last edited by JPM2008 : 10-30-2008 at 05:35 PM. Reason: Automerged Doublepost |
||||
|
|
|
|
#19 | ||||
|
Running System Stock
Forum Newbie
Posts: 1
Last Seen: 11-10-2008
|
Great stuff! Much thanks!
|
||||
|
|
|
|
#20 | ||||
|
Meth Santa!
Senior Member
|
|||||
|
|
|
|
| Please Register to Post a Reply |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Windows HPC Server 2008 | BONES3066 | General Windows Troubleshooting | 0 | 09-18-2008 07:57 AM |
| making a ftp using IIS 7 from server 2008 | BONES3066 | General Windows Troubleshooting | 3 | 05-27-2008 03:37 PM |
| Server 2008 | smokozuna | General Windows Troubleshooting | 2 | 05-25-2008 05:45 PM |
| server 2008, worth it | BONES3066 | General Windows Troubleshooting | 8 | 05-23-2008 02:35 AM |
| Longhorn Server to be christened Windows Server 2008 | chris4404 | The Front Page Headlines | 0 | 05-11-2007 12:32 PM |
| Thread Tools | |
|
|