When the page loads I get no errors, but nothing displays to the screen - please help as I am an extreme newbie to dot net.
Datagrid
I've been beating my head in here for an hour - any help is highly appreciated!!
Code:
Protected Sub Page_Load
'Get date and time to display to screen
Dim dtNow As DateTime = DateTime.Now
DisplayDate.text = dtNow.ToString( "D" )
'Query tbl_TraverTracker in Intranet DB on ESSPITSRV01 and bind data to
'label AllTrips
Dim myConn AS New SQLConnection("SERVER=esspitsrv01;DATABASE=intranet;UID=sa;PWD=PRD$3PES$;")
myConn.Open
Dim strSql AS String = "SELECT * FROM tbl_TravelTracker ORDER BY TripNumber"
Dim myCommand AS New SQLCommand(strSQL, myConn)
Dim myDataReader AS SQLDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
'Bind Data
AllTrips.DataSource = myDataReader
AllTrips.DataBind
MyConn.close()
End Sub
Datagrid
Code:
<form id="mainForm" runat="server">
<asp:DataGrid id="AllTrips" runat="server" AutoGenerateColumns="False" EnableViewSate="True"
width="100%">
<columns>
<asp:BoundColumn DataField="TripNumber" HeaderText="Trip #" />
<asp:BoundColumn DataField="ProjectID" HeaderText="Project" />
<asp:BoundColumn DataField="StartDate" HeaderText="Start Date" />
<asp:BoundColumn DataField="EndDate" HeaderText="End Date" />
<asp:BoundColumn DataField="DestinationCity" HeaderText="Destination" />
<asp:BoundColumn DataField="Invoiced" HeaderText="Invoice #" />
</columns>
</asp:DataGrid>
</form>
I've been beating my head in here for an hour - any help is highly appreciated!!