M
Majed Abbas
Guest
Hello
I Have sql table, which contains daily work hours for two years 2020 and 2021.
I want to sum the number of hours for each month into these two years.
my code is
Private Sub btndgv_Click(sender As Object, e As EventArgs) Handles btndgv.Click
Dim dt As New DataTable
Dim lst As New List(Of Integer) _
From {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
For Each item As Integer In lst
Using con As New SqlConnection(My.Settings.Setting)
Dim cmd As New SqlCommand("SELECT sum([Ob1])'Ob1',sum([Ob2])'Ob2' ,sum([Ob3])'Ob3' FROM natt WHERE month([Datum]) = lST and year([Datum]) = 2020", con)
con.Open()
dt.Load(cmd.ExecuteReader())
End Using
Next
DataGridView1.DataSource = dt
End Sub
i got error message
System.Data.SqlClient.SqlException: 'Invalid column name' lST '. "
can you help me
thanks
Continue reading...
I Have sql table, which contains daily work hours for two years 2020 and 2021.
I want to sum the number of hours for each month into these two years.
my code is
Private Sub btndgv_Click(sender As Object, e As EventArgs) Handles btndgv.Click
Dim dt As New DataTable
Dim lst As New List(Of Integer) _
From {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
For Each item As Integer In lst
Using con As New SqlConnection(My.Settings.Setting)
Dim cmd As New SqlCommand("SELECT sum([Ob1])'Ob1',sum([Ob2])'Ob2' ,sum([Ob3])'Ob3' FROM natt WHERE month([Datum]) = lST and year([Datum]) = 2020", con)
con.Open()
dt.Load(cmd.ExecuteReader())
End Using
Next
DataGridView1.DataSource = dt
End Sub
i got error message
System.Data.SqlClient.SqlException: 'Invalid column name' lST '. "
can you help me
thanks
Continue reading...