Click here to Skip to main content
15,915,172 members
Home / Discussions / C#
   

C#

 
AnswerRe: Convert Dll c#2 to WOrk on C#4 Pin
PIEBALDconsult8-Aug-11 15:37
mvePIEBALDconsult8-Aug-11 15:37 
GeneralRe: Convert Dll c#2 to WOrk on C#4 Pin
md_refay8-Aug-11 18:47
md_refay8-Aug-11 18:47 
GeneralRe: Convert Dll c#2 to WOrk on C#4 Pin
Mycroft Holmes8-Aug-11 23:35
professionalMycroft Holmes8-Aug-11 23:35 
QuestionExcel Interop - Excel Not Closing Pin
Kevin Marois8-Aug-11 7:20
professionalKevin Marois8-Aug-11 7:20 
AnswerRe: Excel Interop - Excel Not Closing Pin
PIEBALDconsult8-Aug-11 15:39
mvePIEBALDconsult8-Aug-11 15:39 
AnswerRe: Excel Interop - Excel Not Closing Pin
BobJanova8-Aug-11 23:13
BobJanova8-Aug-11 23:13 
AnswerRe: Excel Interop - Excel Not Closing Pin
NarVish10-Aug-11 1:40
NarVish10-Aug-11 1:40 
QuestionObjectDataSource seems to bind, but doesn't, really. Pin
ShearWater5098-Aug-11 6:58
professionalShearWater5098-Aug-11 6:58 
Hi All,

I will be honest with you - I have taken exactly 1 ASP.NET class (instructional class...not object class, haha), so I might be doing this all wrong. I am developing an online employment application for the company that I work for. In my ASP.NET class, they taught us to try and avoid having our .aspx pages speak directly to the database (which I had always done before), so I am trying my best to use that best practice, but this is my first time doing it like this, and there's still some issues I'm trying to work out. I started building this application like I used to build all my other applications...but I think I need help from some more seasoned professionals on how to streamline what I've done in the past to make it fit what I'm trying to do now.

The way I organize my data is like this:

* DatabaseMethods.cs - class I created that connects to the database and has a queryDatabase(String query){} method that I use for sending queries and retrieving results (it returns DataTable objects that I work with when I send SELECT queries.)
* DataMethods.cs - class I created that has DataTable objects inside it for each of the data tables I'm interested in. This class accepts an instance of DatabaseMethods as a parameter in its constructor. Then, I have methods in here for pulling information out of my database and into my DataTable objects when I need them. (i.e. loadNames(){} would load the Names table from the database into the DataTable object Names in my DataMethods object.) My applications are typically fairly small, but I still usually parameterize these load***() methods so that the select queries aren't pulling entire tables in...my DBA would kill me...and since I am the DBA...that would be a form of suicide. Smile | :)
* I place instances of the DatabaseMethods object and the DataMethods object in the code-behind on my Master page. That way, throughout the whole application, on all the various screens, if I need, say, my Names table, I can just go like this: Master.DataMethods.loadNames(); Master.Names.Rows[0]["firstName"]; If I needed the first name field in the first row of that database table, for example.
* What I've now added are objects for my data, and an ObjectMethods.cs class for loading up those objects. All the objects themselves contain are their default constructors, the data fields I'm interested in for them, and methods that load a particular object from the database based on its ID, and methods that save that particular object to the database, whether by updating an existing row or inserting a new one. I sort of correlate objects to database rows. I wasn't sure how else to do that.

So, now that you understand how my application structure is organized (or messed up, depending on how you look at it - and I am welcome to suggestions on how to improve this), here is where my problem with the ObjectDataSource is:

I have a user control called RelativeSupervisorsRecordView.ascx, which has fields for last name, first name, middle name, and relationship. This is where applicants will enter in any supervisors at our company who are related to them, and how. The user can click an add button to get as many or few of these user controls as they want, in case they have anywhere from zero to a zillion relatives that are supervisors at my company.

The Relationship part of this user control is the issue. The relationship is a database table with ids 1 through 8, and values like Parent, Cousin, Child, Granparent, etc.

My user control connects to my Master page and calls the loadRelationshipTypes() method inside of my ObjectMethods class. That method, in turn, calls loadRelationshipTypes() in my DataMethods.cs class, which populates my Relationships data table. Then, the ObjectMethods class takes that data, creates 8 relationship objects out of it, and returns the objects in an IList<relationshiptypes> to my user control. Then, in the Page_Load method, my user control binds that IList to the DropDownList inside itself. When I watch this happen in debug mode, stepping through the code, everything looks good. The data is coming from the database ok, the objects are being created okay, I'm not seeing any exceptions generated on the DataBind command after I set the datasource property of the dropdownlist control, and all looks well. Then, when the page displays, my drop down list has nothing in it. What gives?

If code would make it easier, let me know and I'll post it.
QuestionHow to unit test this method Pin
chuckdawit8-Aug-11 6:28
chuckdawit8-Aug-11 6:28 
QuestionLucene .Net: search results are case sensitive Pin
NarVish8-Aug-11 2:00
NarVish8-Aug-11 2:00 
AnswerRe: Lucene .Net: search results are case sensitive Pin
Pete O'Hanlon8-Aug-11 2:24
mvePete O'Hanlon8-Aug-11 2:24 
GeneralRe: Lucene .Net: search results are case sensitive Pin
NarVish9-Aug-11 19:58
NarVish9-Aug-11 19:58 
QuestionSerialization of a Func property Pin
cjb1108-Aug-11 0:01
cjb1108-Aug-11 0:01 
Questionproject upgrade Pin
wasifmuneer7-Aug-11 20:40
wasifmuneer7-Aug-11 20:40 
QuestionDatagidview custom data Pin
sarang_k7-Aug-11 18:57
sarang_k7-Aug-11 18:57 
AnswerRe: Datagidview custom data Pin
Mycroft Holmes7-Aug-11 19:16
professionalMycroft Holmes7-Aug-11 19:16 
QuestionC# coding Pin
DammyMulero7-Aug-11 18:54
DammyMulero7-Aug-11 18:54 
AnswerRe: C# coding Pin
Richard MacCutchan7-Aug-11 21:52
mveRichard MacCutchan7-Aug-11 21:52 
AnswerRe: C# coding Pin
BobJanova7-Aug-11 23:14
BobJanova7-Aug-11 23:14 
AnswerRe: C# coding Pin
#realJSOP8-Aug-11 1:49
professional#realJSOP8-Aug-11 1:49 
GeneralRe: C# coding Pin
Not Active8-Aug-11 1:53
mentorNot Active8-Aug-11 1:53 
AnswerRe: C# coding Pin
V.8-Aug-11 2:16
professionalV.8-Aug-11 2:16 
AnswerRe: C# coding Pin
PIEBALDconsult8-Aug-11 2:48
mvePIEBALDconsult8-Aug-11 2:48 
QuestionHow do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
stephen.darling7-Aug-11 11:04
stephen.darling7-Aug-11 11:04 
AnswerRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
PIEBALDconsult7-Aug-11 13:44
mvePIEBALDconsult7-Aug-11 13:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.