views:

52

answers:

1

I am new to the .Net world, and was wanting to create a class so I can learn OOP.

I have a .sln file, with multiple projects in that file. I want to create a class that will accept 3 parameters, a "stored proc name", "UserID" and "PageName". The stored proc will log the id of the person who launches a particular page, the page name and the DateTime (which is in the stored proc). This is for internal monitoring of sensitive HR data.

This proc will be called by the multiple projects within my .sln

Can someone advise me how to create the class, or point me to any resources? Thanks

+5  A: 

A class wouldn't accept parameters. A method within a class would accept parameters.

What you're describing is just a method call that takes the parameters and executes a stored procedure on a SQL server. You can find the documentation on doing that just about anywhere. Such as here: http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson07.aspx

For a basic introduction to Object Oriented Programming, from a .NET perspective, this is as good a place to start as any (and better than many. It teaches in plain English, explaining technical jargon in a clear, understandable manner.). Since you say you're new to .NET and want to learn OOP, I'm not sure if that means "new to programming" or "I've done procedural programming only in the past". Either way, the MSDN Beginner Learning Center has good information regardless of your skill level.

David Stratton
My bad. I meant I need to create a method within the class
Troy
Don't worry about it.. I just want to be sure I answer your question to the best of my ability, and not leave you hanging.
David Stratton
Nice answer and links, +1
Night Shade