Click here to Skip to main content
15,891,473 members
Home / Discussions / Database
   

Database

 
GeneralRe: Syntax error converting datetime from character string..., Pin
Krish - KP3-Aug-07 1:50
Krish - KP3-Aug-07 1:50 
GeneralRe: Syntax error converting datetime from character string..., Pin
Krish - KP3-Aug-07 2:02
Krish - KP3-Aug-07 2:02 
AnswerRe: Syntax error converting datetime from character string..., Pin
Pete O'Hanlon3-Aug-07 1:23
mvePete O'Hanlon3-Aug-07 1:23 
AnswerRe: Syntax error converting datetime from character string..., Pin
Krish - KP3-Aug-07 1:37
Krish - KP3-Aug-07 1:37 
GeneralRe: Syntax error converting datetime from character string..., Pin
Member 38798813-Aug-07 1:42
Member 38798813-Aug-07 1:42 
GeneralRe: Syntax error converting datetime from character string..., Pin
Member 38798813-Aug-07 1:44
Member 38798813-Aug-07 1:44 
GeneralRe: Syntax error converting datetime from character string..., Pin
gauthee3-Aug-07 2:27
gauthee3-Aug-07 2:27 
QuestionDataBinding, the correct order to Fill, update and delete Pin
steve_rm3-Aug-07 0:50
steve_rm3-Aug-07 0:50 
Hello,

VS 2005

I have find myself getting all my code in a mess about having data populated into control and then having to modify the data in the controls.

I always use typed dataset, binding source.

But I have some questions. I have read that you should always perform operations on the binding source

rather than the control it is bound to.
i.e.
If I have a datagridview and I want loop through some rows based on a certain condition, then I should loop through the rows in the binding source and filter for those rows, rather than looping through the dgv rows. Is this a correct assumption.

I have also read that you should set the datasource property of the control only once.
This is what I have done in the past, and please correct if I am wrong.

If I have a child parent relationship then I sent the child binding source to the parents binding source

in the designer, so that if a user click on a combo box then child data is correctly dislayed in the

datagridview, without writing any code.

In the form event I would have sub routines that would call for the controls to be populated.

<br />
Private Sub FillDataGrid()<br />
        Try<br />
            Me.OrderDetailsTableAdapter.Fill(Me.DataSet1.OrderDetails)          <br />
            Me.DataGridView1.DataSource = Me.bsOrderDetails<br />
        Catch ex As Exception<br />
            MsgBox(ex.Message)<br />
        End Try<br />
<br />
    End Sub


<br />
Private Sub FillCombo()<br />
        Try<br />
            Me.ComboBox1.DisplayMember = "OrderID"<br />
            Me.ComboBox1.ValueMember = "OrderID"<br />
            Me.ComboBox1.DataSource = Me.bsOrders<br />
        Catch ex As Exception<br />
            MsgBox(ex.Message)<br />
        End Try<br />
    End Sub


Normally, if was to add a new order details i would call the FillDataGrid() to load the data again, i

normally do this when I delete and modify.

<br />
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles <br />
<br />
btnSave.Click<br />
        Try<br />
            Me.bsOrderDetails.EndEdit()<br />
            Me.OrderDetailsTableAdapter.Update(Me.DataSet1.OrderDetails)<br />
<br />
            Me.FillDataGrid()<br />
        Catch ex As Exception<br />
            MsgBox(ex.Message)<br />
        End Try<br />
    End Sub


This is just a small example, my applications are always much bigger and contain a lot of modifications

to the data and have a lot of controls to update. However, this means that I am always calling re-filling the setting the datasource each time a add, update, or delete has happend to the data.

Any feedback would be most helpful.

Steve
QuestionQuery probs..., Pin
Member 38798812-Aug-07 21:24
Member 38798812-Aug-07 21:24 
AnswerRe: Query probs..., Pin
Pete O'Hanlon3-Aug-07 0:54
mvePete O'Hanlon3-Aug-07 0:54 
AnswerRe: Query probs... Effective Salary Date Pin
andyharman3-Aug-07 1:47
professionalandyharman3-Aug-07 1:47 
QuestionRegarding Sql server Pin
Praveen0292-Aug-07 20:44
Praveen0292-Aug-07 20:44 
AnswerRe: Regarding Sql server Pin
Blue_Boy2-Aug-07 21:20
Blue_Boy2-Aug-07 21:20 
QuestionRe: Regarding Sql server Pin
Praveen0293-Aug-07 1:00
Praveen0293-Aug-07 1:00 
AnswerRe: Regarding Sql server [modified] Pin
Blue_Boy3-Aug-07 4:42
Blue_Boy3-Aug-07 4:42 
QuestionSelecting data between twodates?? Pin
Ron.S2-Aug-07 20:27
Ron.S2-Aug-07 20:27 
AnswerRe: Selecting data between twodates?? Pin
Blue_Boy2-Aug-07 21:18
Blue_Boy2-Aug-07 21:18 
QuestionHow to find duplicate record Pin
yogesh_kumar_agarwal2-Aug-07 18:17
yogesh_kumar_agarwal2-Aug-07 18:17 
AnswerRe: How to find duplicate record Pin
Blue_Boy2-Aug-07 21:25
Blue_Boy2-Aug-07 21:25 
QuestionOracle MetaData Dependency Pin
manish242-Aug-07 17:45
manish242-Aug-07 17:45 
QuestionThe last piece of a puzzle Pin
Sunset Towers2-Aug-07 12:36
Sunset Towers2-Aug-07 12:36 
AnswerRe: The last piece of a puzzle Pin
Christian Graus2-Aug-07 12:51
protectorChristian Graus2-Aug-07 12:51 
QuestionImporting a Tab delimited report file Pin
Jack Fleet2-Aug-07 9:23
Jack Fleet2-Aug-07 9:23 
AnswerRe: Importing a Tab delimited report file Pin
leckey2-Aug-07 9:42
leckey2-Aug-07 9:42 
GeneralRe: Importing a Tab delimited report file Pin
Jack Fleet2-Aug-07 9:52
Jack Fleet2-Aug-07 9:52 

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.