yo_bee
asked on
VB.net Tableadapter query not showing desired results
I have a simple VB datagridview form that is used to update a table in my MSSQL DB.
Form looks like this:
I need to run the query and get sum total of all the values.
Here is my TableAdapter query.
When I run my form I get a value of 1 for Msgbox when I expect 100.
Form looks like this:
I need to run the query and get sum total of all the values.
Here is my TableAdapter query.
Private Sub SearchBTN_Click(sender As Object, e As EventArgs) Handles SearchBTN.Click
Me.CV_Allocation_TblTableAdapter.FillMatterID(CVDataSet.CV_Allocation_Tbl, Nothing)
StatusLabel1.Text = "Ready"
Try
If CheckBox1.Checked = False Then
Me.CV_Allocation_TblTableAdapter.FillMatterID(CVDataSet.CV_Allocation_Tbl, TextBox1.Text)
Else
Me.CV_Allocation_TblTableAdapter.FillExactMatterid(CVDataSet.CV_Allocation_Tbl, TextBox1.Text)
MsgBox(Me.DataTable1TableAdapter.FillSUM(CVDataSet.DataTable1, TextBox1.Text))
End If
Catch ex As Exception
End Try
SELECT SUM([Partner Origination] + [Responsible Partner] + [Case Manager]) AS Total
FROM cv_allocation_tbl
WHERE (MatterID = @matterid)
GROUP BY MatterID
When I run my form I get a value of 1 for Msgbox when I expect 100.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I ended up coming up with something slightly different than my original code. The reason I gave Kyle points is his recommendation of keeping within the same tableadapter. I did not know know to leverage Louis recommendation of compute method, but it seemed like another viable option from what I saw on the internet.
ASKER
This is the reason for me posting for suggestion.