Why don't I get an error message?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The following snippet was a poorly written attempt to update a table by code. There is every reason I should get an error message. The connect string is correct. However, there are no bound controls. I do not create a table nor a row from the dataset. The messagebox in the snipped below properly tells me that no rows were modified. However, I didn't get an error message

An answer would be greatly appreciated

polynomial5


Private Sub btnSaveAndClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveAndClose.Clic
Tr
'Dim dChor As New clsDataCho
'sQuick = txtQuickWord.Tex
'sQuick = sQuick.Tri
'dChor.NewKeywordSet(Me
MsgBox(cnQWKS.DataSource.ToString

cnQWKS.Open(
Dim iKSModified = daQWKS.Update(DsQWKS1, "KeywordSets"
Dim strOutput As Strin
strOutput = "Modified " & iKSModified & " KeywordSet(s)
MessageBox.Show(strOutput, "Update succeeded!", MessageBoxButtons.OK, MessageBoxIcon.Information
daQWK.Update(DsQWKS1, "Keywords"
daQWSP.Update(DsQWKS1, "SearchPhrase"
daQWSP.Update(DsQWKS1, "KeywordSetAssignments"
Catch ex As Exceptio
MessageBox.Show("Type = " & ex.GetType.ToString & vbCr & "Message = " & ex.Message
End Tr
cnQWKS.Close(
Me.Close(
End Sub
 
Hi,

If there is no data to Update you won't get an error.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

polynomial5d said:
The following snippet was a poorly written attempt to update a table by
code. There is every reason I should get an error message. The connect
string is correct. However, there are no bound controls. I do not create a
table nor a row from the dataset. The messagebox in the snipped below
properly tells me that no rows were modified. However, I didn't get an
error message.
An answer would be greatly appreciated.

polynomial5d



Private Sub btnSaveAndClose_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnSaveAndClose.Click
Try
'Dim dChor As New clsDataChor
'sQuick = txtQuickWord.Text
'sQuick = sQuick.Trim
'dChor.NewKeywordSet(Me)
MsgBox(cnQWKS.DataSource.ToString)

cnQWKS.Open()
Dim iKSModified = daQWKS.Update(DsQWKS1, "KeywordSets")
Dim strOutput As String
strOutput = "Modified " & iKSModified & " KeywordSet(s)"
MessageBox.Show(strOutput, "Update succeeded!",
MessageBoxButtons.OK, MessageBoxIcon.Information)
 
Like Miha Mentions, Update doesn't raise an exception just because there's
nothing to update. That would really make things messy. If you need that
functionality, just check someInteger = DataAdapter.Update(DataSet) and if
someInteger is 0, throw whatever exception (or custom one if you want)
polynomial5d said:
The following snippet was a poorly written attempt to update a table by
code. There is every reason I should get an error message. The connect
string is correct. However, there are no bound controls. I do not create a
table nor a row from the dataset. The messagebox in the snipped below
properly tells me that no rows were modified. However, I didn't get an
error message.
An answer would be greatly appreciated.

polynomial5d



Private Sub btnSaveAndClose_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnSaveAndClose.Click
Try
'Dim dChor As New clsDataChor
'sQuick = txtQuickWord.Text
'sQuick = sQuick.Trim
'dChor.NewKeywordSet(Me)
MsgBox(cnQWKS.DataSource.ToString)

cnQWKS.Open()
Dim iKSModified = daQWKS.Update(DsQWKS1, "KeywordSets")
Dim strOutput As String
strOutput = "Modified " & iKSModified & " KeywordSet(s)"
MessageBox.Show(strOutput, "Update succeeded!",
MessageBoxButtons.OK, MessageBoxIcon.Information)
 
Thanks you two. I really didn't know this. I'll be soon at your heels again when my attempt to do it right goes astray.
polynomial5d
 
Back
Top