Click here to Skip to main content
15,886,362 members
Home / Discussions / Database
   

Database

 
GeneralRe: Data Binding, Combo Boxes, and Related tables. Pin
Luc Pattyn28-Sep-10 15:54
sitebuilderLuc Pattyn28-Sep-10 15:54 
GeneralRe: Data Binding, Combo Boxes, and Related tables. Pin
Roger Wright29-Sep-10 3:13
professionalRoger Wright29-Sep-10 3:13 
GeneralRe: Data Binding, Combo Boxes, and Related tables. Pin
Mycroft Holmes29-Sep-10 12:09
professionalMycroft Holmes29-Sep-10 12:09 
GeneralRe: Data Binding, Combo Boxes, and Related tables. Pin
Roger Wright29-Sep-10 17:00
professionalRoger Wright29-Sep-10 17:00 
GeneralRe: Data Binding, Combo Boxes, and Related tables. Pin
MSBassSinger30-Sep-10 3:24
professionalMSBassSinger30-Sep-10 3:24 
GeneralRe: Data Binding, Combo Boxes, and Related tables. Pin
Mycroft Holmes30-Sep-10 12:03
professionalMycroft Holmes30-Sep-10 12:03 
GeneralRe: Data Binding, Combo Boxes, and Related tables. Pin
MSBassSinger30-Sep-10 12:24
professionalMSBassSinger30-Sep-10 12:24 
GeneralRe: Data Binding, Combo Boxes, and Related tables. Pin
patzerFish30-Sep-10 4:20
patzerFish30-Sep-10 4:20 
Thanks for the feedback! I have begun to implement my own DAL building the CRUD (create, retrieve, update, delete) methods - but I've managed to do it without using datatables, following the model I used in a project where I was using C# to MySQL:

private static void executeNonQuery(String query) {
    SqlCommand command = new SqlCommand(query, Connection);
    try {
        openConnection();
        command.ExecuteNonQuery();
    } catch {
        throw;
    } finally {
        closeConnection();
    }
}

private static SqlDataReader executeQuery(String query) {
    SqlCommand command = new SqlCommand(query, Connection);
    SqlDataReader reader;
    try {
        openConnection();
        reader = command.ExecuteReader();
        return reader;
    } catch {
        throw;
    } finally {
        //connection left open because the reader is worked on elsewhere.
    }
}


These methods are the core of the DAL class. Each other static method (create, retrieve, update, delete) uses one of these two methods and pretty much has the responsibility of building a query string and passing it on. In the case of SELECT queries, a SqlDataReader is returned to be worked on. I haven't felt the need to push this data into a datatable, since it's fairly easy to just move this data into a data object or List<> of data objects. It will require more work on the side of binding data to form controls, but I think I prefer having more control over what is going on anyway.

Thanks again for your quick response!
GeneralRe: Data Binding, Combo Boxes, and Related tables. Pin
Mycroft Holmes30-Sep-10 11:53
professionalMycroft Holmes30-Sep-10 11:53 
AnswerRe: Data Binding, Combo Boxes, and Related tables. Pin
underclocker30-Sep-10 6:00
underclocker30-Sep-10 6:00 
Questionnew line Pin
scottichrosaviakosmos25-Sep-10 23:00
scottichrosaviakosmos25-Sep-10 23:00 
AnswerRe: new line Pin
Mycroft Holmes25-Sep-10 23:40
professionalMycroft Holmes25-Sep-10 23:40 
AnswerRe: new line Pin
Corporal Agarn28-Sep-10 6:44
professionalCorporal Agarn28-Sep-10 6:44 
AnswerRe: new line Pin
bigbadben30-Sep-10 2:55
bigbadben30-Sep-10 2:55 
Question(INSERT EXEC statement cannot be nested.) and (Cannot use the ROLLBACK statement within an INSERT-EXEC statement.) how to solve this??!! Pin
Yajjoj25-Sep-10 9:43
Yajjoj25-Sep-10 9:43 
QuestionCreate Database in Oracle 9i Pin
MohanMbnr25-Sep-10 3:01
MohanMbnr25-Sep-10 3:01 
AnswerRe: Create Database in Oracle 9i Pin
Eddy Vluggen25-Sep-10 12:01
professionalEddy Vluggen25-Sep-10 12:01 
QuestionCreate database to share folder Pin
ndkit24-Sep-10 15:50
ndkit24-Sep-10 15:50 
AnswerRe: Create database to share folder Pin
Eddy Vluggen25-Sep-10 0:56
professionalEddy Vluggen25-Sep-10 0:56 
QuestionQuery Improvement Related to Lounge Post Pin
programmervb.netc++24-Sep-10 11:07
programmervb.netc++24-Sep-10 11:07 
AnswerRe: Query Improvement Related to Lounge Post Pin
Luc Pattyn24-Sep-10 11:29
sitebuilderLuc Pattyn24-Sep-10 11:29 
GeneralRe: Query Improvement Related to Lounge Post Pin
programmervb.netc++24-Sep-10 11:35
programmervb.netc++24-Sep-10 11:35 
AnswerRe: Query Improvement Related to Lounge Post Pin
Mycroft Holmes24-Sep-10 15:32
professionalMycroft Holmes24-Sep-10 15:32 
GeneralRe: Query Improvement Related to Lounge Post Pin
programmervb.netc++24-Sep-10 19:09
programmervb.netc++24-Sep-10 19:09 
GeneralRe: Query Improvement Related to Lounge Post Pin
programmervb.netc++27-Sep-10 13:50
programmervb.netc++27-Sep-10 13:50 

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.