Jump to content

p_richardson

Members
  • Posts

    3
  • Joined

  • Last visited

p_richardson's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I would like to make an web application for registering onto a course. When i have decided which course I want to sign up/pay for, I need to display 'check availability' of the course dates.When a user clicks 'check availability':-the server checks the dates for the course.-but only displays the dates that are available (and not the ones that are full)-If a date or dates are full- the server checks the waiting list - but only displays the waiting list option if there is room on the list- If no room on course and no room on waiting list- the server does not display any options for that date (s).- If no dates are available for the course at all, a message to appear to say 'sorry all the dates that currently full and waiting list is also full. Please call us on.... or fill out the form requesting for us to get in contact if a position appears in the course.I have made up tables and I was wondering if anyone could help me with the stored procedures to get the check availability to work (like easyjet checking for available flights, etc.)This is what i got so far- a SP for one of the courses - BSO. I have asked it to find dates (column) in Table Dates for BSO. Is this correct so far?? I want it to display the dates, but if a date is full for it to look at the waiting list table for BSO and to do a check on the number of students on the course (from student column)- how do i do that - what code should i insert into this SP? CREATE PROCEDURE dbo.AvailabilityASSELECT DatesFROM [Dates for BSO]RETURN
  2. I get this error coming up... and have no idea how to solve this issue... please can anyone offer me any help, advice or ideas how to solve this!!! Server Error in '/' Application.Compilation ErrorDescription: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.Compiler Error Message: BC30289: Statement cannot appear within a method body. End of method assumed.Source Error:Line 5: Sub btnExpertise_Click(sender As Object, e As EventArgs)Line 6: Line 7: Function GetExpertise() As System.Data.SqlClient.SqlDataReaderLine 8: Dim connectionString As String = "server='localhost'; user id='sa'; password='password'; Database='Specialists'"Line 9: Dim sqlConnection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionString)
  3. I am trying to have 3 drop down lists (Name, Expertise, Location). Each of these drop down lists have their choices that the user could select and then click on 'submit button'. When user clicks on that submit button... (lets say Mr Jones from the 'Name drop down list') ... it will come with Mr Jones and his expertise and his location. The information is stored in a database.When the information is recieved... I want it to display in a table with 3 coloums (Name, Expertise, Location) and Mr Jones' information to be displayed in the 3 coloums accordingly.Please can someone help me to be able to achieve this.I would be most appreciated if someone could tell me what i need to do and in what order I should do this in.Alternatively could someone please tell me what and where I have gone wrong in my attempt to do this from the code below:<%@ Page Language="VB" %><%@ Register TagPrefix="wmx" Namespace="Microsoft.Saturn.Framework.Web.UI" Assembly="Microsoft.Saturn.Framework, Version=0.5.464.0, Culture=neutral, PublicKeyToken=6f763c9966660626" %><script runat="server"> Sub btnExpertise_Click(sender As Object, e As EventArgs) Function GetExpertise() As System.Data.SqlClient.SqlDataReader Dim connectionString As String = "server='localhost'; user id='sa'; password='********'; Database='Specialists'" Dim sqlConnection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionString) Dim queryString As String = "SELECT [specialists].[Name], [specialists].[Expertise], [specialists].[secondary "& _ "Expertises], [specialists].[Location] FROM [specialists]" Dim sqlCommand As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(queryString, sqlConnection) sqlConnection.Open Dim dataReader As System.Data.SqlClient.SqlDataReader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection) Return dataReader End Function End Sub Function SpecialistName() As System.Data.SqlClient.SqlDataReader Dim connectionString As String = "server='localhost'; user id='sa'; password='password'; Database='Specialists'" Dim sqlConnection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionString) Dim queryString As String = "SELECT [specialists].[Name], [specialists].[Expertise], [specialists].[secondary "& _ "Expertises], [specialists].[Location] FROM [specialists]" Dim sqlCommand As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(queryString, sqlConnection) sqlConnection.Open Dim dataReader As System.Data.SqlClient.SqlDataReader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection) Return dataReader End Function Sub Page_Load(sender as Object, e as EventArgs) If Not Page.IsPostBack then specialists.DataSource = GetExpertise() specialists.DataBind() End If End Sub Sub expertise_SelectedIndexChanged(sender As Object, e As EventArgs) dgspecialists.DataSource = GetSpecialistsByExpertise(expertise.SelectedItem.Value) dgspecialists.DataBind() End Sub Sub btnName_Click(sender As Object, e As EventArgs) 'Format the data entered by the user and 'append it to the existing contents of lblResults lblResults.Text = "<b>" & _ ddlName.SelectedItem.Text & _ lblResults.Text End Sub Sub btnLocation_Click(sender As Object, e As EventArgs) 'Format the data entered by the user and 'append it to the existing contents of lblResults lblResults.Text = "<b>" & _ ddlLocation.SelectedItem.Text & _ lblResults.Text End Sub Sub DataGrid1_SelectedIndexChanged(sender As Object, e As EventArgs) End Sub Sub ddlExpertise_SelectedIndexChanged(sender As Object, e As EventArgs) Response.Write("<br>Text selected: "& expertise.SelectedItem.Text) Response.Write("<br>Value selected: "& expertise.SelectedItem.Value) End Sub</script><html><head></head><body> <form runat="server"> <p> Search By Specialist's Expertises: <asp:DropDownList id="ddlExpertise" runat="server" Width="221px" OnSelectedIndexChanged="ddlExpertise_SelectedIndexChanged"> <asp:ListItem Value="<Please Select Expertise>" Selected="True"><Please Select Expertise></asp:ListItem> <asp:ListItem Value="Knee">Knee</asp:ListItem> <asp:ListItem Value="Hip">Hip</asp:ListItem> <asp:ListItem Value="Autologous Chondrocyte Implantation">Autologous Chondrocyte Implantation</asp:ListItem> <asp:ListItem Value="Shoulder">Shoulder</asp:ListItem> <asp:ListItem Value="Foot">Foot</asp:ListItem> <asp:ListItem Value="Ankle">Ankle</asp:ListItem> <asp:ListItem Value="Lumbar Discectomy">Lumbar Discectomy</asp:ListItem> <asp:ListItem Value="Lumbar Fusion">Lumbar Fusion</asp:ListItem> <asp:ListItem Value="lumbar decompression">lumbar decompression</asp:ListItem> <asp:ListItem Value="Calcaneum">Calcaneum</asp:ListItem> <asp:ListItem Value="Proximal Humerus">Proximal Humerus</asp:ListItem> <asp:ListItem Value="Scaphoid">Scaphoid</asp:ListItem> <asp:ListItem Value="Distal Radius">Distal Radius</asp:ListItem> <asp:ListItem Value="Forearm">Forearm</asp:ListItem> <asp:ListItem Value="Distal Humerus">Distal Humerus</asp:ListItem> <asp:ListItem Value="Humerus">Humerus</asp:ListItem> <asp:ListItem Value="Colles Fracture">Colles Fracture</asp:ListItem> <asp:ListItem Value="Nerve Repair">Nerve Repair</asp:ListItem> <asp:ListItem Value="Tetraplegia Surgery">Tetraplegia Surgery</asp:ListItem> </asp:DropDownList> <asp:Button id="btnExpertise" onclick="btnExpertise_Click" runat="server" Text="Find"></asp:Button> <br /> Search By Specialist's Name: <asp:DropDownList id="ddlName" runat="server" Width="287px"> <asp:ListItem Value="<Please Select Name>" Selected="True"><Please Select Name></asp:ListItem> <asp:ListItem Value="Prof. James Richardson">Prof. James Richardson</asp:ListItem> <asp:ListItem Value="Mr. Simon Roberts">Mr. Simon Roberts</asp:ListItem> <asp:ListItem Value="Mr. JayTrivedi">Mr. JayTrivedi</asp:ListItem> <asp:ListItem Value="Mr Nilesh Makwana">Mr Nilesh Makwana</asp:ListItem> <asp:ListItem Value="Mr Cormac Kelly">Mr Cormac Kelly</asp:ListItem> <asp:ListItem Value="Mr David Ford">Mr David Ford</asp:ListItem> <asp:ListItem Value="Mr Stuart Hay">Mr Stuart Hay</asp:ListItem> <asp:ListItem Value="Mr George Tselentakis">Mr George Tselentakis</asp:ListItem> <asp:ListItem Value="Mr Simon Pickard">Mr Simon Pickard</asp:ListItem> </asp:DropDownList> <asp:Button id="btnName" onclick="btnName_Click" runat="server" Text="Find"></asp:Button> <br /> <!-- Insert content here -->Search By Location of Specialists: <asp:DropDownList id="ddlLocation" runat="server" Width="287px"> <asp:ListItem Value="<Please Select Location>" Selected="True"><Please Select Location></asp:ListItem> <asp:ListItem Value="Oswestry">Oswestry</asp:ListItem> <asp:ListItem Value="London- All">London- All</asp:ListItem> <asp:ListItem Value="London City">London City</asp:ListItem> <asp:ListItem Value="London- West">London- West</asp:ListItem> <asp:ListItem Value="London- North">London- North</asp:ListItem> <asp:ListItem Value="London- East">London- East</asp:ListItem> <asp:ListItem Value="London- South">London- South</asp:ListItem> <asp:ListItem Value="Manchester">Manchester</asp:ListItem> <asp:ListItem Value="Liverpool">Liverpool</asp:ListItem> <asp:ListItem Value="Birmingham">Birmingham</asp:ListItem> <asp:ListItem Value="Newcastle">Newcastle</asp:ListItem> <asp:ListItem Value="Nottingham">Nottingham</asp:ListItem> </asp:DropDownList> <asp:Button id="btnLocation" onclick="btnLocation_Click" runat="server" Text="Find"></asp:Button> <br /> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p tabindex="1"> <br /> <br /> <wmx:MxDataGrid id="dgSpecialist" runat="server" Width="524px" AllowSorting="True" Height="135px" DataSourceControlID="SqlDataSourceControl1" AutoGenerateFields="False" DataMember="Specialists" AllowPaging="True" DataKeyField="Name" BackColor="White" BorderColor="#CCCCCC" BorderWidth="1px" CellPadding="3" BorderStyle="None"> <SelectedItemStyle font-bold="True" forecolor="White" backcolor="#669999"></SelectedItemStyle> <ItemStyle forecolor="#000066"></ItemStyle> <FooterStyle forecolor="#000066" backcolor="White"></FooterStyle> <HeaderStyle font-bold="True" forecolor="White" backcolor="#006699"></HeaderStyle> <PagerStyle horizontalalign="Center" forecolor="#000066" backcolor="White" mode="NumericPages"></PagerStyle> <Fields> <wmx:BoundField DataField="Name" SortExpression="Name" HeaderText="Name"></wmx:BoundField> <wmx:BoundField DataField="Expertise" SortExpression="Expertise" HeaderText="Expertise"></wmx:BoundField> <wmx:BoundField DataField="Secondary Expertises" SortExpression="Secondary Expertises" HeaderText="Secondary Expertises"></wmx:BoundField> <wmx:BoundField DataField="Location" SortExpression="Location" HeaderText="Location"></wmx:BoundField> </Fields> </wmx:MxDataGrid> <br /> <br /> <br /> <br /> </p> <p> </p> <p> </p> <p runat="server"> </p> <p runat="server"> </p> </form></body></html>
×
×
  • Create New...