ช่วยดูโค้ดการตรวจสอบข้อมูลห้องเรียนให้ด้วยค่ะได้โปรด
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
Dim conn As New SqlConnection
Dim da As New SqlDataAdapter
Dim comm As New SqlCommand
Dim dr As SqlDataReader
Dim ds As New DataSet
Dim sqlSearch As String
Dim Str3 As String
Dim IsFind As Boolean = False
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
conn = New SqlConnection("server=(local);initial catalog=Piyamas;integrated security=SSPI;persist security info=False; workstation id=local;packet size=4096")
conn.Open()
Sub btnOK_Click(ByVal obj As Object, ByVal e As EventArgs)
Try
Str3 = "SELECT c.Room_id, Day_name, Service_start, Service_stop, Subject_name, Teacher_Fname" _
& " FROM Day_room d, Class c, Subject s, Teacher t " _
& " WHERE c.Day_id=d.Day_id and c.Subject_id=s.Subject_id and c.Teacher_id=t.Teacher_id " _
& " = '" & Trim(ddlRoom.SelectedItem.Text) & Trim(ddlDay.SelectedItem.Text) & "' "
da.SelectCommand = New SqlCommand(Str3, conn)
da.Fill(ds) 'มัน Error ตรงนี้ลงมาเคยค่ะ
lblroom_id.Text = ds.Tables("sqlSearch").Rows(0)("Room_id")
lblDay.Text = ds.Tables(0).Rows(0)("Day_name")
lblStart.Text = ds.Tables(0).Rows(0)("Service_start")
lblstop.Text = ds.Tables(0).Rows(0)("Service_stop")
lblSubject.Text = ds.Tables(0).Rows(0)("Subject_name")
lblTeacher.Text = ds.Tables(0).Rows(0)("Teacher_Fname")
Catch ex As Exception
MsgBox("ไม่สามารถค้นหาข้อมูลได้ ไม่พบข้อมูลที่ต้องการค้นหา Error = " + ex.Message)
End Try
End Sub
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874"/>
<title>!!!ระบบจองห้องเรียน Room Reservation!!! Develop By Piyamas >></title>
<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
<style type="text/css">
<!--
.style4 {font-size: 9px}
.style5 {color: #009999}
.style6 {
color: #FFFFFF;
font-weight: bold;
font-size: 14px;
}
.style7 {color: #000000}
.style10 {color: #000000; font-size: 14px; }
-->
</style>
</head>
<body>
<div id="wrapper">
<div id="header">
<div id="right" style="width: 504px; height: 405px">
<h2 align="center">
ตรวจสอบตารางการใช้ห้องเรียน</h2>
<div id="welcome" style="text-align: center">
<form action="" method="post" id="frmSearch" runat="server">
<br />
<table width="472" border="0" cellpadding="1" cellspacing="0">
<tr>
<td colspan="4" style="width: 136px; height: 3px; text-align: left">
เลือกวันที่</td>
<td colspan="2" style="width: 369px; height: 3px; text-align: left">
<asp:DropDownList ID="ddlRoom" runat="server" Width="66px">
<asp:ListItem>1304</asp:ListItem>
<asp:ListItem>1317</asp:ListItem>
<asp:ListItem>1303</asp:ListItem>
<asp:ListItem>1302</asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<td colspan="4" style="width: 136px; height: 3px; text-align: left">
เลือกวันที่</td>
<td colspan="2" style="width: 369px; height: 3px; text-align: left">
<asp:DropDownList ID="ddlDay" runat="server">
<asp:ListItem Value="Mon" Text="จันทร์"></asp:ListItem>
<asp:ListItem Value="Mon" Text="อังคาร"></asp:ListItem>
<asp:ListItem Value="Mon" Text="พุธ"></asp:ListItem>
<asp:ListItem Value="Mon" Text="พฤหัสบดี"></asp:ListItem>
<asp:ListItem Value="Mon" Text="ศุกร์"></asp:ListItem>
<asp:ListItem Value="Mon" Text="เสาร์"></asp:ListItem>
<asp:ListItem Value="Mon" Text="อาทิตย์"></asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<td colspan="4" style="width: 136px; height: 3px; text-align: left">
เวลาเริ่มต้น</td>
<td style="width: 369px; text-align: left; height: 3px;" colspan="2">
<asp:TextBox ID="txtstart" runat="server" Width="64px"></asp:TextBox>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>PM</asp:ListItem>
<asp:ListItem>AM</asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<td style="height: 22px; width: 136px; text-align: left;" colspan="4">เวลาสิ้นสุด</td>
<td style="width: 369px; height: 22px; text-align: left;" colspan="2">
<asp:TextBox ID="txtstop" runat="server" Width="66px"></asp:TextBox>
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem>PM</asp:ListItem>
<asp:ListItem>AM</asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<td style="width: 136px" colspan="4"> </td>
<td colspan="2" style="width: 369px"> </td>
</tr>
<tr>
<td style="width: 136px" colspan="4"> </td>
<td colspan="2" style="width: 369px; text-align: left"><asp:Button ID="btnOK" Text="ตรวจสอบ" OnClick="btnOK_Click" runat="server" /></td>
</tr>
<tr>
<td style="width: 136px" colspan="4"> </td>
<td colspan="2" style="width: 369px"> </td>
</tr>
</table>
<br />
<asp:Label ID="lblMsg" runat="server" Width="78px"></asp:Label><br />
<br />
<table style="width: 473px">
<tr>
<td style="width: 43px; height: 26px;">
</td>
<td style="width: 34px; height: 26px">
</td>
<td style="width: 43px; height: 26px">
</td>
<td style="width: 55px; text-align: left; height: 26px;">
</td>
<td style="width: 77px; height: 26px;">
</td>
<td style="width: 8px; height: 26px;">
</td>
</tr>
<tr>
<td style="width: 43px; text-align: left">
<asp:Label ID="lblroom_id" runat="server"></asp:Label></td>
<td style="width: 34px; text-align: left">
<asp:Label ID="lblDay" runat="server"></asp:Label></td>
<td style="width: 43px; text-align: left">
<asp:Label ID="lblStart" runat="server"></asp:Label></td>
<td style="width: 55px; text-align: left;">
<asp:Label ID="lblstop" runat="server"></asp:Label></td>
<td style="width: 77px">
<asp:Label ID="lblSubject" runat="server"></asp:Label></td>
<td style="width: 8px">
<asp:Label ID="lblTeacher" runat="server"></asp:Label></td>
</tr>
<tr>
<td style="width: 43px; text-align: left">
</td>
<td style="width: 34px; text-align: left">
</td>
<td style="width: 43px; text-align: left">
</td>
<td style="width: 55px">
</td>
<td style="width: 77px">
</td>
<td style="width: 8px">
</td>
</tr>
</table>
</form>
</div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>
</div>
<div id="left">
<div id="logo">
<h1>Room Reservations </h1>
<p>By Piyamas </p>
</div>
<div id="nav">
<ul>
<li class="important"><a href="index.html">หน้าแรก</a></li>
<li><a href="search.aspx">ตรวจสอบตารางใช้ห้อง</a></li>
<li><a href="room_detail.aspx">รายละเอียดห้องเรียน</a></li>
<li><a>แผนผังห้องเรียน</a></li>
<li><a href="reserve.aspx">จองห้องเรียน</a></li>
<li><a href="login.aspx">ออกจากระบบ</a></li>
</ul>
</div>
<div id="news">
<h2>Latest News</h2>
<h3>11/01/08</h3>
<p align="right">มีการจัดสัมนาที่ห้อง 2300 เรื่อง การบริหารและพัมนาเว็บไซต์อย่างมืออาชีพ</p>
<p align="right"><a href="#" class="style4">more</a><br />
</p>
<div class="hr-dots"> </div>
<h3>12/01/08</h3>
<p>ห้อง 1407 ปิดปรับปรุงชั่วคราว </p>
<p class="more"><a href="http://www.freewebsitetemplates.com"> more</a></p>
<p class="more">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function greeting() {
var today = new Date();
var hrs = today.getHours();
document.writeln("<CENTER>");
document.write("");
document.writeln("<BR>");
document.write("<H1>สวัสดี ");
if (hrs < 6)
document.write("วันใหม่");
else if (hrs < 12)
document.write("ตอนเช้า");
else if (hrs <= 18)
document.write("ตอนบ่าย");
else
document.write("ตอนเย็น");
document.writeln("!</H1>");
document.write("คุณเข้าชมหน้านี้ในวันที่ ");
dayStr = today.toLocaleString();
document.write(dayStr);
document.writeln("</CENTER>");
}
function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11)
{
this[0] = m0;
this[1] = m1;
this[2] = m2;
this[3] = m3;
this[4] = m4;
this[5] = m5;
this[6] = m6;
this[7] = m7;
this[8] = m8;
this[9] = m9;
this[10] = m10;
this[11] = m11;
}
function calendar()
{
var monthNames = "JanFebMarAprMayJunJulAugSepOctNovDec";
var today = new Date();
var thisDay;
var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30,31, 30, 31);
year = today.getYear() + 0;
thisDay = today.getDate();
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
monthDays[1] = 29;
nDays = monthDays[today.getMonth()];
firstDay = today;
firstDay.setDate(1);
testMe = firstDay.getDate();
if (testMe == 2)
firstDay.setDate(0);
startDay = firstDay.getDay();
document.writeln("<CENTER>");
document.write("<TABLE BORDER>");
document.write("<TR><TH COLSPAN=7>");
document.write(monthNames.substring(today.getMonth() * 3,
(today.getMonth() + 1) * 3));
document.write(". ");
document.write(year);
document.write("<TR><TH>sun<TH>mon<TH>tue<TH>wed<TH>thu<TH>fri<TH>sat");
document.write("<TR>");
column = 0;
for (i=0; i<startDay; i++) {
document.write("<TD>");
column++;
}
for (i=1; i<=nDays; i++) {
document.write("<TD>");
if (i == thisDay)
document.write("<FONT COLOR=\"#FF0000\">")
document.write(i);
if (i == thisDay)
document.write("</FONT>")
column++;
if (column == 7) {
document.write("<TR>");
column = 0;
}
}
document.write("</TABLE>");
document.writeln("</CENTER>");
}
greeting();
document.write("</br>");
calendar();
document.write("");
// End -->
</SCRIPT>
</p>
</div>
<div id="support">
<p class="style5">Call: 084-1095356<br />
email:[email protected] </p>
</div>
<br />
<br />
<br />
<br />
<br />
</div>
<div class="clear"> </div>
<div id="spacer">
<br />
<br />
<br />
</div>
<div id="footer">
<div id="copyright">
Copyright © 2007 By Piyamas Kotsombut </div>
<div id="footerline"></div>
</div>
</div>
</body>
</html>
Tag : - - - -
Date :
3 ม.ค. 2551 12:07:06
By :
marryann
View :
1522
Reply :
1
คือว่าต้องเลือกห้องเรียน วันใช้บริการ เวลาเริ่มใช้และเวลาเลิกใช้บริการ คือถ้ามีข้อมูลการใช้บริการห้องให้
โชว์รายละเอียดต่างๆ แต่ถ้าไม่มีการใช้บริการให้แสดงว่าห้องว่างค่ะ ประมาณนี้นะค่ะ ช่วยแก้โค้ดให้ด้วยนะค่ะ
ขอบคุณไว้ล่วงหน้า (หัวจะแตกอยู่แล้วใกล้ส่งแล้วด้วยเศร้า)
Date :
3 ม.ค. 2551 12:11:49
By :
marryann
Load balance : Server 00