0

Inline Code Example Here
con.Open()
cmd.Connection = con
cmd.CommandText = "SELECT MONTH(SalesDate) as MonthlySales,Detail.ProductID, Sum (Detail.Qty/30) as Qty FROM Detail INNER JOIN HeadON Detail.HeadID = Head.HeadIDGroup By MONTH(SalesDate), Detail.ProductID"
Dim da As New SqlDataAdapter("SELECT MONTH(SalesDate) as MonthlySales,Detail.ProductID, Sum (Detail.Qty/30) as Qty FROM Detail INNER JOIN HeadON Detail.HeadID = Head.HeadIDGroup By MONTH(SalesDate), Detail.ProductID", con)
Dim dt As New DataTable
da.Fill(dt)
DataGridView1.DataSource = dt

The above is my query for my datagrid view nd it keeps saying

Incorrect syntax near '.'.

but when i do it in the query bulider in sql server it is fine can someone help please

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by BitBlt
0

If this is copied verbatim from your code editor, then you could use some well-placed spaces, especially in and around your join clauses. Maybe in your query builder, they showed as line breaks, but didn't translate well into your code?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.