Hi luisguillermo...,
Check this example. Now please take its reference and correct your code.
Database
For this example I have used of Northwind database that you can download using the link given below.
Download Northwind Database
Controller
Public Class HomeController
Inherits Controller
' GET: Home
Function Index() As ActionResult
Return View(GetData())
End Function
Private Function GetData() As DataSet
Dim conString As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
Dim query As String = "SELECT TOP 5 CustomerID,ContactName,Country FROM Customers"
Using con As SqlConnection = New SqlConnection(conString)
Dim cmd As SqlCommand = New SqlCommand(query)
Using sda As SqlDataAdapter = New SqlDataAdapter()
cmd.Connection = con
sda.SelectCommand = cmd
Using ds As DataSet = New DataSet()
sda.Fill(ds)
Return ds
End Using
End Using
End Using
End Function
End Class
View
@Code
Layout = Nothing
End Code
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<table cellpadding="0" cellspacing="0">
<tr>
<th>CustomerId</th>
<th>Name</th>
<th>Country</th>
</tr>
<tbody>
@For Each row In Model.Tables(0).Rows
@<tr>
<td>@row("CustomerId")</td>
<td>@row("ContactName")</td>
<td>@row("Country")</td>
</tr>
Next
</tbody>
</table>
</body>
</html>
Screenshot