Addressing a SQL Server DB using C#

By Tony.In.Kent ·
OK - be gentle please I know how stoopid this is going to sound.

I've recently inherited a SQLServer DB - with no handover and no documentation.

I'm not a software person as such, but have done a lot in the past with VB, MSAccess and a few other things.

I've had no problem understanding the DB and learning the basics of SQL server but I now need to address the web front end.

(The DB by the way is hosted on a remote PC to which I have remote desktop access).

I've found the source code for the webpages making up the front end and from the other angle I have established which SQLServer store procedures appear to be feeding data to/from the front end. But what I can't find at all is how the front end addresses the database.

I believe it is using compiled c# code, but I cannot see how I look at / modify that.

See, I told you it would sound stupid!

Can anyone give me some pointers on where to look - or what further information I need to give you to give you a clue?

Grateful for ANY help here.



This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -


by Shellbot In reply to Addressing a SQL Server D ...

Do you mean how is the web app "connecting" to the database?? OR..more the web server / client model?

(maybe I'm just being stupid..brain is dead tonight..)

Collapse -

Presumably this is IIS?

by Tony Hopkinson In reply to Addressing a SQL Server D ...

If so have a poke about in the console, you should see a set iof dlls on teh path, coutrse where the source for them is, is anybodys guess.

You can go execute stored procedures from ASP, again IIS will tell you all the stuff it knows about. It's got to be in there somewhere.

Collapse -

Shelbot & Tony

by Tony.In.Kent In reply to Addressing a SQL Server D ...


Thanks for responding.

<b>Shelbot</b> - My description that's faulty not your comprehension I'm sure!

Yes I want to see how the web app connects to the DB and also what it does with the "interactions" - For eg I have one Stored Procedure that is just a Select Query that obviously presents data to the web app - but I'd need to see what the web app is doing with it. Also I have another stored procedure that receives parameters (again must be from the web app) and uses them to write to the db but again I want to see what the web app is doing.

Tony thanks I think you might be pointing me in the right direction re dlls.

Just to expand the opening "webpage" is an .aspx file which includes the line

<%@ Page Language="C#" Autoeventwireup="trueup" Codebehind="Start.aspx.cs" Inherits="specificarea.start.start" %>

I'm not familiar with the syntax of this line - so even a pointer to an online reference would be handy - but I did grasp that this is "invoking" the start.aspx.cs" file (which I think is native c# code? - I'm sort of familar with c# syntax although I've never used it and more to the point probably, never used any tools to compile it.

start.aspx.cs starts with a number of using statements.

using system;
using specificarea.lib;

Now there's no specificarea.lib file on the hard drive but there is a specificarea.dll

And if I'm joining the dots correctly that may well be the compiled file from the c# code I'm looking for?

There is also a specificarea.pdb file - if that helps?

Poking about there are quite a few .cs files and somewhere in there is probably the raw code I am looking for.

(Unless you tell me I've gone off on the wrong track).

Is there such thing as a "project" file that tells me which .cs files are compiled together to make the dll?

- I'll still have the task of interpreting just what the c code is doing, but I think I'll be able to make my own way from there (well at least mostly!)

Collapse -

You mentioned you know VB?

by scott_heath In reply to Shelbot & Tony

Using statement are like Import statements in VB.NET. The .CS files aren't "compiled", but the site is. You can convert the CS to VB if it will help. A DLL file is compiled, and it could be a whole host of custom functions, classes, and subroutines.

Luckily for you .NET code is never truly "compiled". Even DLLs and EXEs are easily reverse engineered. All .NET code is converted to MISL for JIT compilation byt the .NET Framework engine. Thus you can use some thing like .NET Reflector from RedGate,

Here is a free C# to VB converter (can't vouch for it's accuracy, but you can look around)

Also, "code behind" is just .NET ASPX's way of providing a "scripting" language like Java for web development. Each web page has a code behind page that contains all of the subroutines, functions, etc that can be run from the page by clicking on a button or performing some other event. It's really no different than referencing a file using the <script> tag in standard HTML.

Good luck!

Collapse -

If you've got the dll and the pdb

by Tony Hopkinson In reply to Shelbot & Tony

that means you have a .net dll deployed(installed) on to the webserver.
So now all you have to do is find the code that it was compiled from.

Visual studio projects have an extension of .sln (solution), it's not guarantted that there is one though. .csproj for C# or .cproj from C++ or .vbproj are also possible. specicifarea.* of you development machines is apossibility. If your place has twe brain cells in close proximity, it should all be in source control somewhere TFS or VSS, or even some other...

Best of luck.

PS you can 'open' the dll with visual studio, and it will show you all teh types and methods that are accfessible from it, which might help, and worst case you can decompile the dll back to VB or C#, though teh code might be somewhat unreadable in places.

Back to Networks Forum
6 total posts (Page 1 of 1)  

Related Discussions

Related Forums