when i click for bug an aplication.
it's always show this a notification
{"Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition."}
view on browser aplication
Line 33:
Line 34: GridView1.DataSource = dt
Line 35: GridView1.DataBind()
Line 36: End Sub
Line 37:
this is an my vb code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Me.BindGrid()
End If
End Sub
Private Sub BindGrid()
Dim dt As New DataTable()
Dim query As String = "SELECT [KodeBarang], [NamaBarang], [Kuantitas], [Satuan], [Keterangan] FROM [TSPPInput] WHERE ([KodeSPP] = '" & TxtKodeSPP.Text & "')"
Dim constr As String = ConfigurationManager.ConnectionStrings("CosmoConnectionString").ConnectionString
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand(Query)
cmd.Connection = con
Using sda As New SqlDataAdapter(cmd)
sda.SelectCommand = cmd
sda.Fill(dt)
End Using
End Using
End Using
If dt.Rows.Count = 0 Then
'If no records then add a dummy row.
dt.Rows.Add()
End If
GridView1.DataSource = dt
GridView1.DataBind()
End Sub
please help me to clearing this problem.
regards.