-1

I'm sure this has been answered before, but every example I try I can't seem to connect to my SQL Server.

I'm using SQL Server 2014, and the webpage is being hosted in IIS on Windows 7 x64.

I'm trying to get my webpages to build themselves recursively from information in a database, I've configured IIS to run ASP pages (I believe its classic ASP as opposed to ASP.net, but I may be wrong)

I started by looking at examples that basically returned all entries in in a particular column in a table, however when i got error messages on trying to load the page:

An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click here to find out more about this error.

I tried stripping it down to bare minimum, i.e. just opening the connection to the database.

And even then I get the same error, here are a few of the examples I tried:

Firstly if anyone could tell me how to debug it further, i.e. getting proper error messages that actually tell me something useful, that would be a good start.

If there's any information I missed then please ask.

Community
  • 1
  • 1
James Kent
  • 5,763
  • 26
  • 50

1 Answers1

3

If you've given your files the extension .asp then it is Classic ASP

Do you know what version of SQL Server you're using? If it's express then you need to say so in your connection string eg Data Source=yourserveraddress\SQLEXPRESS

I recommend using the OLEDB method in Example 3 rather than the ODBC method in 1 and 2 but they should all work. This is a good resource for Connection Strings

http://www.connectionstrings.com/sql-server/

If you follow the steps on this page you will be able to see more useful error messages

http://www.chestysoft.com/asp-error-messages.asp

John
  • 4,658
  • 2
  • 14
  • 23
  • its the full version, would you be able to explain what the difference is between the two methods and why you would use each? – James Kent Oct 01 '14 at 19:15
  • If you google OLEDB vs ODBC you should find plenty of background reading. I really do recommend that you enable Classic ASP error messages as per my second link and post the error message you get then. The standard 500 Please contact the System Admin message isn't a great deal of use – John Oct 01 '14 at 20:41
  • 1
    @John: *If it's express then you need to say so in your connection string eg Data Source=yourserveraddress/SQLEXPRESS* - That's not true. It is possible to give the SQL instance any name you want. – Paul Oct 02 '14 at 07:48
  • 2
    @John Like Paul says instance names are not specific to SQL Server Express. They also take the form `SERVER\Instance` (not `/`). By default SQL Server Express looks for `SERVER\SQLEXPRESS` as an instance name. – user692942 Oct 02 '14 at 08:34
  • @Lankymart Yes, thanks for spotting that forward slash, very careless of me. I've corrected it – John Oct 02 '14 at 09:17
  • No worries @John I spot stuff like that on other answers just never my own. – user692942 Oct 02 '14 at 09:25
  • If you guys don't want to have to refer to SQL instance by `/Instance`, I suggest you look at the answer from Zasz: http://stackoverflow.com/questions/35026/sql-server-convert-a-named-instance-to-default-instance – Control Freak Oct 02 '14 at 12:06
  • @John why would you use chestysoft to gather asp errors? Asp has this functionality already built-in. http://powerasp.net/content/new/on-error-resume-next.asp – Control Freak Oct 02 '14 at 12:09
  • @ZeeTee I think you may have missed the point that link is a guide to setting up detailed error messages on IIS 7+. – user692942 Oct 02 '14 at 13:19
  • @ZeeTee SQL Server Express can't use a "default instance" it has to always be named by default it's `SERVER\SQLEXPRESS` as already stated. Only "full" SQL Server editions can have a default instance (MSSQLSERVER). – user692942 Oct 02 '14 at 13:21
  • Thanks for the help, i had made a few mistakes the main one being that i initially missed off the machine name for the source. thanks for the help setting up the detailed error messages, has been very useful. – James Kent Oct 10 '14 at 13:44