【发布时间】:2013-07-22 20:50:41
【问题描述】:
我正在使用 Visual Web Developer 2010 为学校创建一个“项目”。这很简单。
这个想法是为医疗机构的病人自助值机亭。
我已经使用以下内容创建了我的 sql 数据库:
Table: Doctors
Fields: Doctor_ID (PK), Doctor_F_Name, Doctor_L_Name
Table: Patients
Fields: Patient_ID (PK), Patient_F_Name, Patient_L_Name
Table: Appointments
Fields: Appointment_ID (PK), Appt_Day, Appt_Mo, Appt_Yr, Patient_ID (SK), Doctor_ID (SK), Appt_Time, Appt_Reason, Checked_In
所以代码的第一页有一个简单的布局,其中包含 3 个文本输入框,要求输入患者的名字、姓氏和 SSN (Patient_ID) 的最后 4 位和一个提交按钮。
我希望将文本框中的数据用于与数据库进行比较并提出以下问题:“您今天在 (Appt_Time) 与 (Dr. Doctor_L_Name ) 表示 (Appt_Reason)?),然后是复选框或下拉列表表示是或否,如果选择是,则将“1”(binary) 插入到 check_in 字段中
我已经创建了文本框和按钮:
<script runat="server">
sub submit (sender as object, e as eventargs)
lbl1.text= "Hello, " & Textbox1.text &" " & Textbox2.Text
end sub
</script>
<h2> First Name </h2>
<asp:textbox id=Textbox1" runat"server" />
<h2> Last Name </h2>
<asp:textbox id=Textbox2" runat"server" />
<h2> Last 4 of SSN </h2>
<asp:textbox id=Textbox3" runat"server" />
<asp:button: ID="Button1" onclick="submit" runat="server" text="submit" />
<asp::label id="lbl1" runat="server" />
在下面,我进行了一些调试检查以确保与 sql 服务器的通信正常,并且我可以使用以下连接设置将表信息拉入 gridview 而不会出现问题:
<asp:sqldatasource id="sqldatasource3" runat="server" connectionstring="<%$ connectionstrings:PB_MedicalConnectionString %>"
selectcommand="select * from [Patients]" />
然后运行一个gridview:
<asp:gridview id="gridview1" runat="server" datakeyNames="Patient_ID" Datasource="sqldatasource3">
<columns>
<asp:boundfield datafield="Patient_ID" HeaderText="Patient_ID" ReadOnly="True" SortExpression=""Patient_ID" />
<asp:boundfield datafield="Patient_F_Name" HeaderText="Patient_F_Name" ReadOnly="True" SortExpression=""Patient_F_Name" />
<asp:boundfield datafield="Patient_L_Name" HeaderText="Patient_L_Name" ReadOnly="True" SortExpression=""Patient_L_Name" />
</columns>
<//asp:gridview>
这样就成功返回了已经输入数据库的“患者”。
任何帮助创建/完成它都会很棒。我已经厌倦了寻找技巧,尝试,失败搜索,尝试,失败......
谢谢, 埃里克
【问题讨论】:
-
Eric,祝贺你到目前为止所做的一切!欢迎来到堆栈溢出。我在这里你说:“这是我完成的代码,为我完成我的学校项目”。虽然我能感觉到你的沮丧,但有句古话:“授人以鱼,饿一千年,授人以鱼,食一千年”。请就您的问题提出具体问题,因为我们无法为您“完成您的课堂作业”。编程是:“尝试,失败搜索,尝试,失败......”
-
我遇到的问题是我不知道如何获取输入的数据并将其与表格进行比较,获取有效条目并返回网页,然后在“是”后完成插入被选中。我猜我需要编写一个我在 python 中完成的 if/then/else,我只是不知道如何将它放入 asp 中,所以它是可用的。 AMD。郑重声明,这不是家庭作业,它更像是一个自我分配的项目,我不是在寻找完成它,我正在寻求帮助,下一步该去哪里写代码等等。
-
对不起,我在逻辑上犯了一个错误......不得不更新它重新措辞。让我知道这是否解释了它应该如何工作。
标签: asp.net .net sql sql-server vb.net