Sqlserver
 sql >> Datenbank >  >> RDS >> Sqlserver

Füllen Sie die Datenrasteransicht aus der SQL-Tabelle

Versuchen Sie diesen Code .

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