Hi,

I have a small application which includes a routine which produces several
outputs from various datagridviews.
I want the outputs to be entered into a bound datagridview and then saved so
that over a period of time the outputs db will increase in size.
But....the code I use, inputs the data but does not save it in the db
behind. The catch that I have included even tells me that the save has been
successful. I have looked through some websites but I don't really
understand what is going on.
Below is the code that I use but any help or advice would be most welcome.

Many thanks

James

Dim p As Integer
Dim todaysDate As New System.DateTime
Alpha.HistoryLog.Visible = True
todaysDate = System.DateTime.Now

'DESCRIBES NEW ROW

Dim newHistory As DataRow = Alpha.HistoryDataSet.History.NewRow
newHistory(0) = todaysDate
newHistory(1) = Alpha.Filepath.Text & "\\" & Alpha.Select_Month.Text
newHistory(2) = Alpha.Error_Count.Text.ToString
p = (Alpha.Error_Count.Text / Alpha.TotalRows.Text) * 100
newHistory(3) = p & "%"
Alpha.HistoryDataSet.History.Rows.Add(newHistory)

'VALIDATES & UPDATES WITH CATCH
Try
Alpha.Validate()
Alpha.HistoryDataSetBindingSource.EndEdit()
Alpha.HistoryTableAdapter.Update(Alpha.HistoryDataSet)
MsgBox("Update successful")

Catch ex As Exception
MsgBox("Update failed")
End Try

Re: Datagridview to datasource help needed by Dmytro

Dmytro
Tue Mar 14 05:37:44 CST 2006

Hi James,

First things first: Have you configured the UpdateCommand for the data
adapter you use?

"James Batley" <JamesBatley@discussions.microsoft.com> wrote in message
news:521EB230-7BB3-4344-ABA2-03D6DC534508@microsoft.com...
> Hi,
>
> I have a small application which includes a routine which produces several
> outputs from various datagridviews.
> I want the outputs to be entered into a bound datagridview and then saved
> so
> that over a period of time the outputs db will increase in size.
> But....the code I use, inputs the data but does not save it in the db
> behind. The catch that I have included even tells me that the save has
> been
> successful. I have looked through some websites but I don't really
> understand what is going on.
> Below is the code that I use but any help or advice would be most welcome.
>
> Many thanks
>
> James
>
> Dim p As Integer
> Dim todaysDate As New System.DateTime
> Alpha.HistoryLog.Visible = True
> todaysDate = System.DateTime.Now
>
> 'DESCRIBES NEW ROW
>
> Dim newHistory As DataRow = Alpha.HistoryDataSet.History.NewRow
> newHistory(0) = todaysDate
> newHistory(1) = Alpha.Filepath.Text & "\\" &
> Alpha.Select_Month.Text
> newHistory(2) = Alpha.Error_Count.Text.ToString
> p = (Alpha.Error_Count.Text / Alpha.TotalRows.Text) * 100
> newHistory(3) = p & "%"
> Alpha.HistoryDataSet.History.Rows.Add(newHistory)
>
> 'VALIDATES & UPDATES WITH CATCH
> Try
> Alpha.Validate()
> Alpha.HistoryDataSetBindingSource.EndEdit()
> Alpha.HistoryTableAdapter.Update(Alpha.HistoryDataSet)
> MsgBox("Update successful")
>
> Catch ex As Exception
> MsgBox("Update failed")
> End Try