Click here to Skip to main content
15,902,922 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionGood freeware barcode reader library Pin
vincentvdm22-Aug-15 22:04
vincentvdm22-Aug-15 22:04 
AnswerRe: Good freeware barcode reader library Pin
Eddy Vluggen24-Aug-15 5:27
professionalEddy Vluggen24-Aug-15 5:27 
QuestionAdd a DTPicker in a Column of grid in vb6.0 Pin
Anand_@ndy21-Aug-15 19:08
Anand_@ndy21-Aug-15 19:08 
AnswerRe: Add a DTPicker in a Column of grid in vb6.0 Pin
Eddy Vluggen24-Aug-15 5:26
professionalEddy Vluggen24-Aug-15 5:26 
QuestionHow To Set H-Scrolling And V-Scrolling With AspxpivoteGrid Devexpress Pin
Member 1174163219-Aug-15 22:30
Member 1174163219-Aug-15 22:30 
AnswerRe: How To Set H-Scrolling And V-Scrolling With AspxpivoteGrid Devexpress Pin
Eddy Vluggen24-Aug-15 5:23
professionalEddy Vluggen24-Aug-15 5:23 
QuestionVB, SQL Linq, 2 Joins and multiple Groups Pin
jkirkerx18-Aug-15 8:41
professionaljkirkerx18-Aug-15 8:41 
QuestionSql Linq, Adding a group Join or Join and performing Sums, I can't figure out the Join in VB Pin
jkirkerx17-Aug-15 13:45
professionaljkirkerx17-Aug-15 13:45 
This is a different problem, but basically the same as I posted in Database.
The difference is that my issues are VB based, and not really database related.
So I can sort of see how to do it in C#, but it doesn't translate to VB EF 6
I can't figure it out. I'm close on it.

So I wrote this years ago, works fine in TSQL. It's an Order Table, that has a SalesTax State Code and SalesTax collected columns. It joins a Table called SalesTaxStates, on the StateCode, and the TSQL Sums up the Order SubTotal and SalesTax, and then gets the StateName, TaxRate.
"DECLARE @startDate AS DATE; " & _
"DECLARE @stopDate AS DATE; " & _
"SET @startDate = DATETIMEFROMPARTS(@Year, 1, 1, 0, 0, 0, 0); " & _
"SET @stopDate = DATETIMEFROMPARTS(@Year, @LastMonth, @LastDay, 23, 59, 59, 999); " & _
"SELECT " & _
"  sts.StateCode " & _
", sts.StateName " & _
", sts.HasSalesTax " & _
", SUM(oh.SubTotal) AS SubTotal " & _
", sts.StateTaxRate " & _
", SUM(oh.SalesTax) AS SalesTax " & _
" From ORDER_HISTORY oh " & _
"LEFT JOIN Shipping_TaxStates sts " & _
"ON sts.StateCode = oh.SalesTaxState " & _
"WHERE oh.OrderDate > @startDate " & _
"AND ohOrderDate < @stopDate " & _
"GROUP BY sts.StateCode, sts.StateName, sts.StateTaxRate, sts.HasSalesTax " & _
"ORDER BY sts.StateName "
I have tried many things today.
I tried a Group Join Into xxx = group
I tried Group By oh = new With / Select New With group.Sum(function(m) m.Qty)
In each case, I can the oh stuff and the sums, but I can't access the Join columns for taxRate
So below is a stable version that works with oh. I figure I'll post something that works rather than complete slop.
Dim m_startDate As DateTime = New DateTime(p_Year, 1, 1, 0, 0, 0, 0)
Dim m_stopDate As DateTime = New DateTime(p_Year, p_LastMonth, p_LastDay, 23, 59, 59, 999)

        Dim context As New DBContext()

        pResults = _
        (
           From oh In context.Order_History
           Where oh.OrderDate >= m_startDate _
           And oh.OrderDate <= m_stopDate _
           And oh.OrderStatus = "COMPLETED"
           Group By oh = New With
           {
               oh.SalesTaxState,
               oh.SubTotal,
               oh.SalesTax
           } Into Group
           Select New With
           {
               .StateCode = oh.SalesTaxState,
               .subTotal = Group.Sum(Function(m) m.SubTotal),
               .salesTax = Group.Sum(Function(m) m.SalesTax)
           }
       )

AnswerRe: Sql Linq, Adding a group Join or Join and performing Sums, I can't figure out the Join in VB Pin
Richard Deeming18-Aug-15 1:07
mveRichard Deeming18-Aug-15 1:07 
GeneralRe: Sql Linq, Adding a group Join or Join and performing Sums, I can't figure out the Join in VB Pin
jkirkerx18-Aug-15 6:37
professionaljkirkerx18-Aug-15 6:37 
QuestionExcel VBA read application CPU Usage Pin
Member 1191534517-Aug-15 8:24
Member 1191534517-Aug-15 8:24 
AnswerRe: Excel VBA read application CPU Usage Pin
Wendelius17-Aug-15 8:33
mentorWendelius17-Aug-15 8:33 
GeneralRe: Excel VBA read application CPU Usage Pin
Member 1191534517-Aug-15 9:14
Member 1191534517-Aug-15 9:14 
GeneralRe: Excel VBA read application CPU Usage Pin
Mycroft Holmes17-Aug-15 13:03
professionalMycroft Holmes17-Aug-15 13:03 
RantRe: Excel VBA read application CPU Usage Pin
Richard Deeming18-Aug-15 0:24
mveRichard Deeming18-Aug-15 0:24 
GeneralRe: Excel VBA read application CPU Usage Pin
Wendelius18-Aug-15 9:20
mentorWendelius18-Aug-15 9:20 
QuestionMenuItem question Pin
econy17-Aug-15 4:36
econy17-Aug-15 4:36 
GeneralRe: MenuItem question Pin
Ralf Meier17-Aug-15 18:21
mveRalf Meier17-Aug-15 18:21 
GeneralRe: MenuItem question Pin
econy18-Aug-15 2:20
econy18-Aug-15 2:20 
GeneralRe: MenuItem question Pin
Ralf Meier18-Aug-15 5:06
mveRalf Meier18-Aug-15 5:06 
QuestionStoring Files inside SQL server database : Good or BAD idea ? Pin
satc15-Aug-15 5:25
satc15-Aug-15 5:25 
GeneralRe: Storing Files inside SQL server database : Good or BAD idea ? Pin
PIEBALDconsult15-Aug-15 5:41
mvePIEBALDconsult15-Aug-15 5:41 
GeneralRe: Storing Files inside SQL server database : Good or BAD idea ? Pin
satc15-Aug-15 6:36
satc15-Aug-15 6:36 
GeneralRe: Storing Files inside SQL server database : Good or BAD idea ? Pin
PIEBALDconsult15-Aug-15 7:25
mvePIEBALDconsult15-Aug-15 7:25 
GeneralRe: Storing Files inside SQL server database : Good or BAD idea ? Pin
satc15-Aug-15 7:49
satc15-Aug-15 7:49 

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.