home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 September / PCWorld_2003-09_cd.bin / Software / Vyzkuste / webmatrix / WebMatrix.msi / Data1.cab / _4E97D5FE2FCE42EBB70E5EA5ABF42684 < prev    next >
Encoding:
ASP.NET Web Form  |  2003-04-28  |  1.7 KB  |  49 lines

  1. <%@ Page Language="VB"%%ClassName, ClassName="{0}"%% %>
  2. <%@ Import Namespace="System.Data" %>
  3. <%@ Import Namespace="System.Data.SqlClient" %>
  4.  
  5. <script runat="server">
  6.  
  7.     Sub Page_Load(Sender As Object, E As EventArgs)
  8.  
  9.         ' TODO: Update the ConnectionString for your application
  10.         Dim ConnectionString As String = "server=(local);database=Northwind;trusted_connection=true"
  11.  
  12.         ' TODO: Updatd the name of the Stored Procedure for your application
  13.         Dim CommandText As String = "CustOrdersDetail"
  14.         
  15.         Dim myConnection As New SqlConnection(ConnectionString)
  16.         Dim myCommand As New SqlCommand(CommandText, myConnection)
  17.         Dim workParam As New SqlParameter()
  18.  
  19.         myCommand.CommandType = CommandType.StoredProcedure
  20.  
  21.         ' TODO: Set the input parameter, if necessary, for your application
  22.         myCommand.Parameters.Add("@OrderId", SqlDbType.Int).Value = 11077        
  23.  
  24.  
  25.  
  26.         myConnection.Open()
  27.  
  28.         DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
  29.         DataGrid1.DataBind()
  30.  
  31.     End Sub
  32.     
  33. </script>
  34.     
  35. <html>
  36.     <body style="font-family:arial">
  37.         <h2>
  38.             Simple Stored Procedure
  39.         </h2>
  40.         <hr size="1">
  41.         <form runat="server">
  42.             <asp:datagrid id="DataGrid1" EnableViewState="False" runat="server" ForeColor="Black" BackColor="White" CellPadding="3" GridLines="None" CellSpacing="1">
  43.                 <HeaderStyle Font-Bold="True" ForeColor="white" BackColor="#4A3C8C"></HeaderStyle>
  44.                 <ItemStyle BackColor="#DEDFDE"></ItemStyle>
  45.             </asp:datagrid>
  46.         </form>
  47.     </body>
  48. </html>
  49.