Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE [dbo].[Prescriptions] (
- [Prescription_ID] INT IDENTITY (1, 1) NOT NULL,
- [Doctor_UserName] NVARCHAR (50) NOT NULL,
- [Patient_UserName] NVARCHAR (50) NOT NULL,
- [Drug_ID] INT NOT NULL,
- PRIMARY KEY CLUSTERED ([Prescription_ID] ASC)
- );
- CREATE PROCEDURE [dbo].[AddPrescription]
- @doctor nvarchar(50),
- @patient nvarchar(50),
- @drug nvarchar(MAX)
- AS
- insert into dbo.Prescriptions (Doctor_UserName,Patient_UserName,Drug_ID)
- Select @doctor, @patient, d.Drug_ID
- from dbo.Drug as d
- where d.Trade_Name = @drug
- <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>" SelectCommand="AddPrescription" SelectCommandType="StoredProcedure">
- <SelectParameters>
- <asp:Parameter Name="doctor" Type="String" />
- <asp:ControlParameter ControlID="PatientDropDown" Name="patient" PropertyName="SelectedValue" Type="String" />
- <asp:ControlParameter ControlID="PrescriptionDropDown" Name="drug" PropertyName="SelectedValue" Type="String" />
- </SelectParameters>
- </asp:SqlDataSource>
- protected void CreatePrescriptionBtn_Click(object sender, EventArgs e)
- {
- SqlDataSource3.SelectParameters["doctor"].DefaultValue = System.Web.HttpContext.Current.User.Identity.Name.ToString();
- SqlDataSource3.DataBind();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement