Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

Riempi la visualizzazione della griglia dei dati dalla tabella sql

Prova questo codice.

getConnect()
Try
    Conn.Open()
    Dim strSQL As String = "SELECT EMP_ID, EMP_NAME FROM EMPLOYEE ORDER BY EMP_NAME ASC"
    Conn.Close()
    Dim da As New SqlDataAdapter(strSQL, Conn)
    Dim ds As new Dataset
    da.Fill(ds,"EMPLOYEE")
    ATCGRID.DataSource = ds.tables(0)
Catch ex As SqlException
    MsgBox(ex.Message, MsgBoxStyle.Critical, "SQL Error")
Catch ex As Exception
    MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
End Try