I am having some issues and I do not know how to Trouble shoot my problem any further.
I have a page that accesses data based on the selected drop down from the Access Northwind Database.
The data is not coming back and i am not sure why.
This is what I have for my code and I am using the WebMatrix software...
If anyone can provide any assistance I would appreciate it..
<%@ Page Language="VB" Debug="true" %> <%@ import Namespace="System.Data.OleDb" %> <script runat="server"> Sub Page_load(Sender As Object, Byval E As EventArgs) If Not Page.IsPostBack Then Dropdownlist1.DataTextField = "CompanyName" Dropdownlist1.dataValueField= "ShipperID" DropDownList1.DataSource = GetShippers() DropDownList1.DataBind() Label2.text=DropDownList1.selecteditem.value End If End Sub Sub getlabel(byval sender As Object, ByVal e As EventArgs) Label2.text=DropDownList1.selecteditem.value End Sub SUB BUTTON1_click(byval sender As Object, ByVal e As EventArgs) Call GETORDER() datagrid1.visible=true End Sub Function GetShippers() As System.Data.DataSet Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\WEB_STUFF\AS"& _ "P\Northwind.mdb" Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString) Dim queryString As String = "SELECT [Shippers].[ShipperID],[Shippers].[Companyname] FROM [Shippers]" Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand dbCommand.CommandText = queryString dbCommand.Connection = dbConnection Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter dataAdapter.SelectCommand = dbCommand Dim dataSet As System.Data.DataSet = New System.Data.DataSet dataAdapter.Fill(dataSet) Return dataSet End Function FUNCTION GETORDER() Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\WEB_STUFF\AS"& _ "P\Northwind.mdb" Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString) dim ShipVia = dropdownlist1.selecteditem.value Dim queryString As String = "SELECT [Orders].[OrderDate], [Orders].[ShipAddress] FROM [Orders] WHERE ([Orders]"& _ ".[ShipVia] = " & ShipVia & ")" Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand dbCommand.CommandText = queryString dbCommand.Connection = dbConnection Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter dataAdapter.SelectCommand = dbCommand Dim DSet As System.Data.DataSet = New System.Data.DataSet dataAdapter.Fill(DSet) DataGrid1.DataSource = dset DataGrid1.DataBind() return dset End function </script> <html> <head> </head> <body> <form runat="server"> <asp:DropDownList id="DropDownList1" style="Z-INDEX: 100; LEFT: 16px; POSITION: absolute; TOP: 52px" runat="server" Autopostback="true" Datatextfield="CompanyName" Datavaluefield="Shipperid" OnSelectedIndexChanged="getlabel"></asp:DropDownList> <asp:Label id="Label2" style="Z-INDEX: 101; LEFT: 160px; POSITION: absolute; TOP: 50px" runat="server">Label</asp:Label><asp:Label id="Label3" style="Z-INDEX: 104; LEFT: 160px; POSITION: absolute; TOP: 11px" runat="server" font-bold="True">Shippers ID</asp:Label> <asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 57px; POSITION: absolute; TOP: 103px" runat="server" AutoGenerateColumns="true"></asp:DataGrid> <asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 245px; POSITION: absolute; TOP: 44px" runat="server" Text="Button"></asp:Button> <!-- Insert content here --> </form> </body> </html>