Start New Discussion within our Software Development Community

When to trying to display data to datagrid view using query i got an error
"a column named date already belongs to this datatable in net 2008"

  Dim dt As New DataTable

            myConnection = New SqlConnection(connectionstring)

            Dim cmd As New SqlClient.SqlCommand
            With cmd
                .CommandText = "SELECT [Date],[Totalamount] FROM [Mobilization] where [Contract_Name]='" & ComboBox1.Text & "' AND [Client_Name]='" & ComboBox2.Text & "'"
                .CommandType = CommandType.Text

                .Connection = myConnection
            End With

            dt.Columns.Add(New DataColumn("Date", System.Type.GetType("System.String")))
            dt.Columns.Add(New DataColumn("Total Amount", System.Type.GetType("System.Double")))

            DataGridView1.DataSource = dt


        Catch err As Exception
            MsgBox(err.Message, MsgBoxStyle.Exclamation)
        End Try

I couldn't find what is the error

This question has already been answered. Start a new discussion instead.