Answered by:
asp.net web app DB connection

Question
-
User609272361 posted
Whats up devs, As a node writer who's just learning asp.net, In what file does the project make its connection to the DB. So far I believe its the web.config but i can not get a fresh copy of the project to connect
Friday, November 8, 2019 2:18 PM
Answers
-
User475983607 posted
Thanks for the insight. This particular project was or is written in classic with very old legacy VB. for the last 20 years it has had many developers "duct tape" new features together and leave virtually no road map of what they have done, whats worse is that there is little to no file maintenance so sifting through the 15k or more files to find the answer has become difficult. Thank you for your help
Keep in mind we all work on application that are many years old...
Again, the first step is opening default.asp and look at line 363. That line and and maybe a few lines above should provide pointers to the design in use. Often there is a function or sub call. Copy the function name and do a search within Visual Studio to find the asp page that contains the function or sub. Sometimes you see lines of code like...
Server.CreateObject("MyCustomActiveXObject")
...which means the application is consuming ActiveX DLLs (VB 6). Hopefully you have the source code.
Sometimes you'll see inline ADO where the connection and SQL is within an asp page.
set objConnection=Server.CreateObject("ADODB.connection")
The key in classic asp is doing a key word search in Visual Studio to find the include files or ActiveX components that do the DB calls.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, November 8, 2019 3:48 PM
All replies
-
User475983607 posted
The web.config contains the connection string. A code file will read the connection string and open a connection. Usually, you'll get an error message that shows which line of code caused the exception along with the actual error. Can you share this information?
Friday, November 8, 2019 2:22 PM -
User609272361 posted
I get 2 separate errors, in the web.config the default documents load in order of default.asp, default.aspx, default.htm and so on. I am using visual studio to view this folder and upon running the default.asp i get this err ---
Microsoft OLE DB Provider for SQL Server error '80004005'
[DBNETLIB][ConnectionOpen (Connect()).]Specified SQL server not found.
/default.asp, line 363
Friday, November 8, 2019 2:28 PM -
User753101303 posted
Hi,
You are using ASP.NET 4.x or ASP.NET Core? (the first one is the latest version for an almost two decade old framework, the later a 3 year old redesign/rewrite cross platform version). In this later case see https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-strings#aspnet-core and more generally https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.0
If "i can not get a fresh copy of the project to connect" means you have a compile or runtime error it's likely best to give right away which error message you have so that we can understand much more easily which wrong thing happens.
Edit: default.asp is unrelated to ASP.NET. You are really trying to learn ASP.NET or you are asked to maintain an app that uses "ASP Classic" pages ? Strictly speaking for now it seems the default.asp page tries to connect to a non existant SQL Server name (or it can't be reached from your PC because of a firewall or configuration issue, for example by default SQL Server Express can only be reached from the same machine).
Friday, November 8, 2019 2:32 PM -
User475983607 posted
This is a classic ASP error not ASP.NET. The first step is opening default.asp and reviewing the code code at and around line 363.
In classic ASP it is common to configure a System DSN Source (Data Source Name) in the ODBC Data Source Administrator tool in Windows. The System DSN contains connection information used to open a connection. You'll need to review the code to determine how the application works or share your code.
Friday, November 8, 2019 2:53 PM -
User609272361 posted
Thanks for the insight. This particular project was or is written in classic with very old legacy VB. for the last 20 years it has had many developers "duct tape" new features together and leave virtually no road map of what they have done, whats worse is that there is little to no file maintenance so sifting through the 15k or more files to find the answer has become difficult. Thank you for your help
Friday, November 8, 2019 2:56 PM -
User475983607 posted
Thanks for the insight. This particular project was or is written in classic with very old legacy VB. for the last 20 years it has had many developers "duct tape" new features together and leave virtually no road map of what they have done, whats worse is that there is little to no file maintenance so sifting through the 15k or more files to find the answer has become difficult. Thank you for your help
Keep in mind we all work on application that are many years old...
Again, the first step is opening default.asp and look at line 363. That line and and maybe a few lines above should provide pointers to the design in use. Often there is a function or sub call. Copy the function name and do a search within Visual Studio to find the asp page that contains the function or sub. Sometimes you see lines of code like...
Server.CreateObject("MyCustomActiveXObject")
...which means the application is consuming ActiveX DLLs (VB 6). Hopefully you have the source code.
Sometimes you'll see inline ADO where the connection and SQL is within an asp page.
set objConnection=Server.CreateObject("ADODB.connection")
The key in classic asp is doing a key word search in Visual Studio to find the include files or ActiveX components that do the DB calls.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, November 8, 2019 3:48 PM -
User609272361 posted
I was able to find the ADODB connection in the foundation file. thank you again
Friday, November 8, 2019 6:40 PM