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

Database

 
GeneralRe: How can I optimize this SQL Query? Pin
Rafferty Uy8-Dec-08 17:18
Rafferty Uy8-Dec-08 17:18 
QuestionHow to access *.dbf file using c# Pin
Kumaran Jeyasingam4-Dec-08 14:32
Kumaran Jeyasingam4-Dec-08 14:32 
AnswerRe: How to access *.dbf file using c# Pin
PIEBALDconsult4-Dec-08 15:33
mvePIEBALDconsult4-Dec-08 15:33 
AnswerRe: How to access *.dbf file using c# Pin
Mycroft Holmes4-Dec-08 21:45
professionalMycroft Holmes4-Dec-08 21:45 
GeneralRe: How to access *.dbf file using c# Pin
Wendelius5-Dec-08 8:24
mentorWendelius5-Dec-08 8:24 
GeneralRe: How to access *.dbf file using c# Pin
Mycroft Holmes5-Dec-08 14:07
professionalMycroft Holmes5-Dec-08 14:07 
GeneralRe: How to access *.dbf file using c# Pin
Kumaran Jeyasingam14-Dec-08 14:58
Kumaran Jeyasingam14-Dec-08 14:58 
QuestionProgram Design - Master DataSet/Adapter for program? Pin
David Hovey4-Dec-08 8:53
David Hovey4-Dec-08 8:53 
Hi All! I am new to using the .NET framework database objects and have a question about how to design my program using Adapter/DataTable queries.

My Database...My database consists of about 10 different tables. No one table is indepedent. All have at least one relationship with another table.

My Program...The program needs to be designed such, that when the user clicks "OK" on whichever dialog, the program will commit the new data to the database.

Here is the jist of what I'm curious about...What is best design for the interaction between my OleDbDataAdapter and the DataSet or DataTables? Do you think these objects should be created with each form? When I need to run a query involving two tables using OleDbCommand it seems I have to use an adapter which then reads the database on disk and not an In-memory object.

Currently, on startup my program reads each table into a DataSet object. For basic queries involving a single table this works fine (using the Select method of DataTable). But anything more complex I now need to create a new DataAdapter and DbCommand objects.

Would it be reasonable to have one OleDbConnection object for application. Then mutiple OleDbAdapter objects for each form. I would also have a OleDbCommandBuilder in each form to allow for the Update method when user wants to commit data.

To illustrate my startup code is below.

Thanks for your help!!!


            m_dsPTData = New DataSet<br />
<br />
            m_dbConnection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strFilename)<br />
            m_dbConnection.Open()<br />
<br />
            m_dbDataAdapter = New OleDbDataAdapter()<br />
<br />
            m_dbDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM Congregations", m_dbConnection)<br />
            m_dbDataAdapter.Fill(m_dsPTData, "Congregations")<br />
            m_dbDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM HomeTalks", m_dbConnection)<br />
            m_dbDataAdapter.Fill(m_dsPTData, "HomeTalks")<br />
            m_dbDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM CongregationSpeakers", m_dbConnection)<br />
            m_dbDataAdapter.Fill(m_dsPTData, "CongregationSpeakers")<br />
            m_dbDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM CongregationSpeakerOutlines", m_dbConnection)<br />
            m_dbDataAdapter.Fill(m_dsPTData, "CongregationSpeakerOutlines")<br />
            m_dbDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM Outlines", m_dbConnection)<br />
            m_dbDataAdapter.Fill(m_dsPTData, "Outlines")<br />
            m_dbDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM OutlineCategories", m_dbConnection)<br />
            m_dbDataAdapter.Fill(m_dsPTData, "OutlineCategories")<br />
            m_dbDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM Readers", m_dbConnection)<br />
            m_dbDataAdapter.Fill(m_dsPTData, "Readers")<br />
            m_dbDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM Chairmen", m_dbConnection)<br />
            m_dbDataAdapter.Fill(m_dsPTData, "Chairmen")<br />
            m_dbDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM Hospitality", m_dbConnection)<br />
            m_dbDataAdapter.Fill(m_dsPTData, "Hospitality")<br />
            m_dbDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM AwayTalks", m_dbConnection)<br />
            m_dbDataAdapter.Fill(m_dsPTData, "AwayTalks")<br />
            m_dbDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM Notes", m_dbConnection)<br />
            m_dbDataAdapter.Fill(m_dsPTData, "Notes")<br />
            m_dbDataAdapter.SelectCommand = New OleDbCommand("SELECT * FROM Conductors", m_dbConnection)<br />
            m_dbDataAdapter.Fill(m_dsPTData, "Conductors")<br />
<br />
            Dim commandBuilder As OleDbCommandBuilder = _<br />
                New OleDbCommandBuilder(m_dbDataAdapter)<br />
<br />
            m_dbConnection.Close()<br />

AnswerRe: Program Design - Master DataSet/Adapter for program? Pin
Wendelius4-Dec-08 9:25
mentorWendelius4-Dec-08 9:25 
GeneralRe: Program Design - Master DataSet/Adapter for program? Pin
David Hovey4-Dec-08 10:56
David Hovey4-Dec-08 10:56 
GeneralRe: Program Design - Master DataSet/Adapter for program? Pin
Wendelius5-Dec-08 7:50
mentorWendelius5-Dec-08 7:50 
QuestionDatabase Problem Pin
sajjadlashari3-Dec-08 22:50
sajjadlashari3-Dec-08 22:50 
AnswerRe: Database Problem Pin
J4amieC3-Dec-08 23:08
J4amieC3-Dec-08 23:08 
AnswerRe: Database Problem Pin
Wendelius4-Dec-08 7:40
mentorWendelius4-Dec-08 7:40 
QuestionNot able to see the Access database structure behind the form Pin
Brendan Vogt3-Dec-08 22:37
Brendan Vogt3-Dec-08 22:37 
AnswerRe: Not able to see the Access database structure behind the form Pin
ChandraRam4-Dec-08 1:59
ChandraRam4-Dec-08 1:59 
AnswerRe: Not able to see the Access database structure behind the form Pin
Jerry Hammond4-Dec-08 6:36
Jerry Hammond4-Dec-08 6:36 
Questionproblem creating database role... Pin
rajkumar.33-Dec-08 22:33
rajkumar.33-Dec-08 22:33 
AnswerRe: problem creating database role... Pin
Wendelius4-Dec-08 3:54
mentorWendelius4-Dec-08 3:54 
QuestionTime out only the first time Pin
samerh3-Dec-08 21:02
samerh3-Dec-08 21:02 
AnswerRe: Time out only the first time Pin
Wendelius4-Dec-08 4:03
mentorWendelius4-Dec-08 4:03 
QuestionNeed to execute a query when postgres service starts Pin
krishnan.s3-Dec-08 20:45
krishnan.s3-Dec-08 20:45 
AnswerRe: Need to execute a query when postgres service starts Pin
Wendelius4-Dec-08 7:06
mentorWendelius4-Dec-08 7:06 
QuestionTo apply a search on every table in a database Pin
rahuladya3-Dec-08 19:49
rahuladya3-Dec-08 19:49 
AnswerRe: To apply a search on every table in a database Pin
Ashfield3-Dec-08 21:09
Ashfield3-Dec-08 21:09 

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.