SQL Server retrieving data with ASP.NET

SQL Server retrieving data with ASP.NET



I've followed the below tutorial to retrieve data from a SQL Server database hosted on 1&1, but I'm getting a runtime error.



Connect to a SQL Server database using ASP.NET



I copied the code and changed the credentials to match a very simple database table I created to test it. I saved the file as an aspx file but when I try and reach the page I get a runtime error. Any suggestions? Complete newbie here so layman terms welcome!


aspx



The error is...



Server Error in '/' Application. Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors>





Welcome to stack overflow Twiss, can you include the runtime error you are getting? Either a screenshot or pasting in the text will work. I'm not very knowledgeable on ASP.net, so I cannot help you, but it will help others in debugging your problem. Thanks!
– Roy Scheffers
Aug 25 at 8:17





@Twiss Important information like that needs to be put in your question, rather than in a comment. You can edit your question by pressing that word underneath your question. I've done that for you, so now you can delete your comment.
– Richardissimo
Aug 25 at 8:45





2 Answers
2



The error message tells you what you need to do. Basically, you cannot see the actual error until you add these lines to your web.config file


<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>



You probably already have a web.config with so in which case you'll just need to add the inner xml somewhere within the body of the file.


<system.web>
<customErrors mode="Off"/>
</system.web>





Thanks Rob, I added the lines but now get this error?
– Twiss
Aug 25 at 10:25





Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: The entry 'EventLogProvider' has already been added. Source Error: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely. It could, however, be viewed by browsers running on the local server machine.
– Twiss
Aug 25 at 10:25





You must have EventLogProvider twice in your web.config then? Make sure you don't have any duplicate elements in the web.config.
– Rob Sedgwick
Aug 26 at 16:35




From the above comment the error says "The entry 'EventLogProvider' has already been added.". Delete the duplicate key with same name in your config file "EventLogProvider". You need also remove this line -


<configuration>
<system.web>
<customErrors mode="RemoteOnly">
</system.web>
</configuration>



And add what Rob mentioned in the answer.



More on this -



error: the details of the application error from being viewed remotely



Please check the below answer also-



The entry '' has already been added error





Thanks for help. The web host provides the web.config, machine.config and a web schlund.config file and as I'm new to all of this I think there is something overriding the error messages. I removed all config files and just put a web.config file in the root directory with just the code above and it worked, I now can see why the page wasn't loading and have fixed the problem. Thank you all!
– Twiss
Aug 25 at 12:35






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế