You don't need to specify System. The System namespace is automatically imported in VB.NET. You also don't need to specify System.Type.GetType... GetType alone is sufficient.
Dim col\_invDate As DataColumn = New DataColumn("invDate")
col\_invDate.DataType = System.Type.**GetType("System.DateTime")**
salesTable.Columns.Add(col\_invDate)
should become this:
Dim col\_invDate As DataColumn = New DataColumn("invDate")
col\_invDate.DataType = **GetType(DateTime)**
salesTable.Columns.Add(col\_invDate)
Next, according to the documentation on DataTable.Compute and DataColumn.Expression, a DateTime value should be enclosed in single quotes or the # sign, depending on the underlying data provider. ...and to make things MUCH easier to read, don't use string concatentation:
x0 = yrSales.Compute("SUM(extPrice)", String.Format("shipToName = '{0}' AND invDate > #{1}# AND invDate < #{2}#", stn, begDate, endDate))
BTW: x0 is a terrible variable name. By looking at the variable name alone, what does it contain?? There is no way to tell.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak