(OWC) y ASP.NET - Willy .Net
(OWC) y ASP.NET - Willy .Net
(OWC) y ASP.NET - Willy .Net
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
6. En el menú Ver, haga clic en Código para ver el código situado detrás del formulario<br />
Web Forms (Webform1.aspx.vb).<br />
7. Agregue el código siguiente al principio de Webform1.aspx.vb:<br />
8. Imports System.Data.SqlClient<br />
9. Imports System.Xml<br />
Imports System.Xml.Xsl<br />
10. Agregue el código siguiente a la función Page Load en Webform1.aspx.vb.<br />
Nota Debe cambiar Id. de usuario y contraseña = a los valores correctos antes de ejecutar este código. Asegúrese de que Id. de<br />
usuario tiene los permisos apropiados realizar esta operación en la base de datos.<br />
11. Dim sConn As String = "User ID=;Password=;Initial Catalog=Northwind;Data Source=YourSQLServer;"<br />
12. Dim sSQL As String = _<br />
13. "SELECT LastName, Sum([UnitPrice]*[Quantity]*(1-[Discount])) AS<br />
OrderTotal " & _<br />
14. "FROM Employees INNER JOIN (Orders INNER JOIN [Order Details] ON<br />
" & _<br />
15. "Orders.OrderID = [Order Details].OrderID) ON Employees.EmployeeID =<br />
" & _<br />
16. "Orders.EmployeeID GROUP BY LastName"<br />
17.<br />
18. 'Connect to the data source.<br />
19. Dim nwindConn As SqlConnection = New SqlConnection(sConn)<br />
20. nwindConn.Open()<br />
21.<br />
22. 'Build a DataSet for Employee Sales.<br />
23. Dim ds As DataSet<br />
24. ds = New DataSet("MyDataset")<br />
25. Dim da As SqlDataAdapter = New SqlDataAdapter(sSQL, nwindConn)<br />
26. da.Fill(ds)<br />
27.<br />
28. 'Add the DataSet as XML to a data island in the PlaceHolder control.