this is my code.

Private Sub cmdSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSearch.Click
        temp = "DaftarGaji"
        modPY.LookUp("SELECT * FROM MS_UMR ORDER BY TAHUN", strCONNECT, 0, 1, temp)    End Sub
Public Sub LookUp(ByVal strRecordtoSearch As String, ByVal strCONNECT As String, ByVal KeyFieldPos As Short, ByVal ResultFieldPos As Short, Optional ByVal temp As String = "")

        frmLookup1.RecordSource(strRecordtoSearch) '.RecordSource = strRecordtoSearch

        frmLookup1.Text = "Result Collection ..."

    End Sub
Public Sub RecordSource(ByVal value As String)

        strSQL = value

 End Sub
Private Sub Frmlookup1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        If strSQL <> Nothing Then


             If rs.State = ADODB.ObjectStateEnum.adStateOpen Then rs.Close()

            rs.Open(strSQL, adcLEDGER, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockPessimistic)

            custDA.Fill(datatable, rs)


            grdDISPLAY.DataSource = datatable

        End If

    End Sub

How can i clear my datagridview. Pleas help me. Thank's

Recommended Answers

All 2 Replies

when i want see my result. for example: "SELECT * FROM MS_UMR ORDER BY TAHUN" i want query this to my result and it occur some duplicate result in my datagridview, than i need to clear it first and then just run the query to avoid my result occur previous result

Delete a record from the database using methods of Command class.

Dim Cmd as new SqlCommand
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.