Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,028

HOME > ASP > ASP Forum > ช่วยหน่อยครับ คือผมต้องการจับเวลานะคับ โดยการเริ่มก็กดปุ่ม start จะเซฟเวลาปัจจุบัน



 

ช่วยหน่อยครับ คือผมต้องการจับเวลานะคับ โดยการเริ่มก็กดปุ่ม start จะเซฟเวลาปัจจุบัน

 



Topic : 037437



โพสกระทู้ ( 10 )
บทความ ( 0 )



สถานะออฟไลน์




คือผมต้องการจับเวลานะคับ โดยการเริ่มก็กดปุ่ม start จะเซฟเวลาปัจจุบัน ณ ขณะนั้น หลังจากเสร็จแล้ว ก็กดปุ่ม stop ก็จะเซฟเวลาปัจจุบัน ต้องแก้ไขโค๊ดตรงไหนมั่งครับ

โค๊ด

<HTML>
<HEAD>
<TITLE> AddAllEmpn</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=windows-620">
<link href="bossStyle.css" rel="stylesheet" type="text/css" />
</HEAD>
<!--#include file="module.asp"-->
<%tmpactionmode = trim(request("actionmode"))
tmpmode = trim(request("mode")) %>
<BODY bgcolor="#F0FFFF">
<form name="form1" method="post" action="addempnallbb.asp">
<%
Set conn = server.createobject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB.1 ; User ID=itdev ; Password=egathr ;Persist Security Info=True;Initial Catalog=service;Data Source=HR-DEVELOP"
Set Rs = Server.CreateObject("ADODB.Recordset")
response.write "<input type='Hidden' name='mode' value='"&tmpmode&"'>"
response.write "<input type='Hidden' name='PONo' value='"&trim(request("PONo"))&"'>"
response.write "<input type='Hidden' name='UserName' value='"&trim(request("UserName"))&"'>"
response.write "<input type='Hidden' name='TimeStart' value='"&trim(request("TimeStart"))&"'>"
response.write "<input type='Hidden' name='TimeStop' value='"&trim(request("TimeStop"))&"'>"
response.write "<input type='Hidden' name='TimeTotal' value='"&trim(request("TimeTotal"))&"'>"
if tmpactionmode="บันทึก" or tmpactionmode="ตกลง" then
if trim(request("PONo"))="" then tmpPONo="-" else tmpPONo=trim(request("PONo")) end if
if trim(request("UserName"))="" then tmpUserName="-" else tmpUserName=trim(request("UserName")) end if
if trim(request("TimeStart"))="" then tmpTimeStart="-" else tmpTimeStart=trim(request("TimeStart")) end if
if trim(request("TimeStop"))="" then tmpTimeStop="-" else tmpTimeStop=trim(request("TimeStop")) end if
if trim(request("TimeTotal"))="" then tmpTimeTotal="-" else tmpTimeTotal=trim(request("TimeTotal")) end if
if tmpactionmode="บันทึกthen
sqlupd= "INSERT INTO dbo.TimeCheck VALUES ('"&trim(request("PONo"))&"','"&tmpUserName&"','"&tmpTimeStart&"','"&tmpTimeStop&"','"&tmpTimeTotal&"')"
conn.Execute (sqlupd)%>
<script LANGUAGE="JavaScript">
alert("บันทึกข้อมูลเรียบร้อยแล้ว");
window.opener.location.reload();
window.close();
</script>
<%elseif tmpactionmode="ตกลง" then
sqlupd= "update dbo.TimeCheck Set UserName = '"&tmpUserName&"',TimeStart='"&tmpTimeStart&"',TimeStop='"&tmpTimeStop&"',TimeTotal='"&tmpTimeTotal&"' Where PONo = '"&trim(request("PONo"))&"' "
conn.Execute (sqlupd)%>
<script LANGUAGE="JavaScript">
alert("แก้ไขข้อมุลเรียบร้อยแล้ว");
window.opener.location.reload();
window.close();
</script>
<%end if%>
<%elseif tmpactionmode="ยืนยัน" then
sqldel=" delete from dbo.TimeCheck where UserName='"&trim(request("UserName"))&"' "
conn.Execute (sqldel)%>
<script LANGUAGE="JavaScript">
alert("ลบข้อมูลเรียบร้อยแล้ว");
window.opener.location.reload();
window.close();
</script>
<%end if %>
<%if tmpmode="add" then
tmpHead="บันทึกข้อมูล"
elseif tmpmode="edit" then
tmpHead="แก้ไขข้อมูล"
elseif tmpmode="del" then
tmpHead="ลบข้อมูล"
end if
if tmpmode<>"add" then
strSQL=" select * from dbo.TimeCheck where PONo = '"&trim(request("PONo"))&"' "
Rs.Open strSQL, conn, 1,3
if not Rs.eof then
if trim(request("UserName")) <> "" then strUserName = trim(request("UserName")) else strUserName=trim(Rs("UserName")) end if
if trim(request("TimeStart")) <> "" then strTimeStart = trim(request("TimeStart")) else strTimeStart=trim(Rs("TimeStart")) end if
if trim(request("TimeStop")) <> "" then strTimeStop= trim(request("TimeStop")) else strTimeStop=trim(Rs("TimeStop")) end if
if trim(request("TimeTotal")) <> "" then strTimeTotal = trim(request("TimeTotal")) else strTimeTotal=trim(Rs("TimeTotal")) end if
end if
else
strUserName=trim(request("UserName"))
strTimeStart=trim(request("TimeStart"))
strTimeStop=trim(request("TimeStop"))
strTimeTotal=trim(request("TimeTotal"))
end if
%>
<table width="60%" border="1" cellspacing="0" cellpadding="1" align="center" bgcolor="#FFCCFF">
<tr bgcolor="">
<td height="30" align="center" valign="middle"><b><%=tmpHead%></b></td>
</tr>
</table><br>
<table width="70%" border="0" cellspacing="0" cellpadding="1" align="center" bgcolor="">
<tr>
<td width="40%" align="right" height="35">เลขที่ PO :&nbsp;&nbsp;</td>
<td ><%=trim(request("PONo"))%></td>
</tr>
<tr>
<td align="right" height="35">ชื่อผู้ใช้งาน :&nbsp;&nbsp;</td>
<td><input name="UserName" type="text" value="<%=session("usr_name")%>" size="20" maxlength="100"></td>
</tr>
<tr>
<td align="right" height="35">เวลาที่เริ่มการค้นหา:&nbsp;&nbsp;</td>
<td><input name="TimeStart" type="text" value="<%response.write Time ()%>" size="20" maxlength="100"></td>
</tr>
<tr>
<td align="right" height="35">เวลาที่หยุดการค้นหา:&nbsp;&nbsp;</td>
<td><input name="TimeStop" type="text" value="<%=strTimeStop%>" size="20" maxlength="100"></td>
</tr>
<tr>
<td align="right" height="35">เวลาที่ใช้ในการค้นหาทั้งหมด:&nbsp;&nbsp;</td>
<td><input name="TimeTotal" type="text" value="<%=strTimeTotal%>" size="20" maxlength="100"></td>
</tr>
</table>
<p align="center">
<%if tmpmode="add" then%>
&nbsp;<input type="submit" name="actionmode" value=" บันทึก " >
<%elseif tmpmode="edit" then%>
&nbsp;<input type="submit" name="actionmode" value=" ตกลง " >
<%elseif tmpmode="del" then%>
&nbsp;<input type="submit" name="actionmode" value=" ยืนยัน ">
<%end if%>
</p>
</form>
</BODY>
</HTML>



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-01-21 15:57:27 By : punkkydear View : 1463 Reply : 2
 

 

No. 1



โพสกระทู้ ( 373 )
บทความ ( 0 )



สถานะออฟไลน์


Code (ASP)
<HTML>
<HEAD>
<TITLE> AddAllEmpn</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=windows-620">
<link href="bossStyle.css" rel="stylesheet" type="text/css" />
</HEAD>
<!--#include file="module.asp"-->
<%tmpactionmode = trim(request("actionmode"))
tmpmode = trim(request("mode")) %>
<BODY bgcolor="#F0FFFF">
<form name="form1" method="post" action="addempnallbb.asp">
<%
   [font=Verdana] Dim dt_start As DateTime
    Dim dt_stop As DateTime
    Dim tsp As TimeSpan
    'เริ่มจับเวลาตอน connect open
    dt_start = DateTime.Now[/font]
Set conn = server.createobject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB.1 ; User ID=itdev ; Password=egathr ;Persist Security Info=True;Initial Catalog=service;Data Source=HR-DEVELOP" 
Set Rs = Server.CreateObject("ADODB.Recordset") 
response.write "<input type='Hidden' name='mode' value='"&tmpmode&"'>"
response.write "<input type='Hidden' name='PONo' value='"&trim(request("PONo"))&"'>"
response.write "<input type='Hidden' name='UserName' value='"&trim(request("UserName"))&"'>"
response.write "<input type='Hidden' name='TimeStart' value='"&trim(request("TimeStart"))&"'>"
response.write "<input type='Hidden' name='TimeStop' value='"&trim(request("TimeStop"))&"'>"
response.write "<input type='Hidden' name='TimeTotal' value='"&trim(request("TimeTotal"))&"'>"
if tmpactionmode="บันทึก" or tmpactionmode="ตกลง" then
if trim(request("PONo"))="" then tmpPONo="-" else tmpPONo=trim(request("PONo")) end if
if trim(request("UserName"))="" then tmpUserName="-" else tmpUserName=trim(request("UserName")) end if
if trim(request("TimeStart"))="" then tmpTimeStart="-" else tmpTimeStart=trim(request("TimeStart")) end if
if trim(request("TimeStop"))="" then tmpTimeStop="-" else tmpTimeStop=trim(request("TimeStop")) end if
if trim(request("TimeTotal"))="" then tmpTimeTotal="-" else tmpTimeTotal=trim(request("TimeTotal")) end if
if tmpactionmode="บันทึกthen
sqlupd= "INSERT INTO dbo.TimeCheck VALUES ('"&trim(request("PONo"))&"','"&tmpUserName&"','"&tmpTimeStart&"','"&tmpTimeStop&"','"&tmpTimeTotal&"')"
conn.Execute (sqlupd)
          [font=Verdana] 'จับเวลาตอน connection execute เสร็จ ปกติจะเอา return value มาตรวจสอบก่อนก็ดีครับ 
            dt_stop = DateTime.Now
            tsp = dtt_stop - dt_start
           'โชว์ว่าใช้เวลาไปเท่าไหร่เป็น seconds ไม่ต้องกดปุ่มหยุดแล้ว 
            alert(tsp.Seconds.ToString)[/font]
%>
<script LANGUAGE="JavaScript">
alert("บันทึกข้อมูลเรียบร้อยแล้ว");
window.opener.location.reload();
window.close();
</script>
<%elseif tmpactionmode="ตกลง" then
sqlupd= "update dbo.TimeCheck Set UserName = '"&tmpUserName&"',TimeStart='"&tmpTimeStart&"',TimeStop='"&tmpTimeStop&"',TimeTotal='"&tmpTimeTotal&"' Where PONo = '"&trim(request("PONo"))&"' "
conn.Execute (sqlupd)%> 
<script LANGUAGE="JavaScript">
alert("แก้ไขข้อมุลเรียบร้อยแล้ว");
window.opener.location.reload();
window.close();
</script>
<%end if%>
<%elseif tmpactionmode="ยืนยัน" then
sqldel=" delete from dbo.TimeCheck where UserName='"&trim(request("UserName"))&"' "
conn.Execute (sqldel)%>
<script LANGUAGE="JavaScript">
alert("ลบข้อมูลเรียบร้อยแล้ว");
window.opener.location.reload();
window.close();
</script>
<%end if %>
<%if tmpmode="add" then
tmpHead="บันทึกข้อมูล"
elseif tmpmode="edit" then
tmpHead="แก้ไขข้อมูล"
elseif tmpmode="del" then
tmpHead="ลบข้อมูล"
end if
if tmpmode<>"add" then
strSQL=" select * from dbo.TimeCheck where PONo = '"&trim(request("PONo"))&"' "
Rs.Open strSQL, conn, 1,3
if not Rs.eof then
if trim(request("UserName")) <> "" then strUserName = trim(request("UserName")) else strUserName=trim(Rs("UserName")) end if
if trim(request("TimeStart")) <> "" then strTimeStart = trim(request("TimeStart")) else strTimeStart=trim(Rs("TimeStart")) end if 
if trim(request("TimeStop")) <> "" then strTimeStop= trim(request("TimeStop")) else strTimeStop=trim(Rs("TimeStop")) end if 
if trim(request("TimeTotal")) <> "" then strTimeTotal = trim(request("TimeTotal")) else strTimeTotal=trim(Rs("TimeTotal")) end if 
end if 
else
strUserName=trim(request("UserName"))
strTimeStart=trim(request("TimeStart"))
strTimeStop=trim(request("TimeStop"))
strTimeTotal=trim(request("TimeTotal"))
end if
%>
<table width="60%" border="1" cellspacing="0" cellpadding="1" align="center" bgcolor="#FFCCFF">
<tr bgcolor="">
<td height="30" align="center" valign="middle"><b><%=tmpHead%></b></td>
</tr>
</table><br>
<table width="70%" border="0" cellspacing="0" cellpadding="1" align="center" bgcolor="">
<tr>
<td width="40%" align="right" height="35">เลขที่ PO :&nbsp;&nbsp;</td>
<td ><%=trim(request("PONo"))%></td>
</tr>
<tr>
<td align="right" height="35">ชื่อผู้ใช้งาน :&nbsp;&nbsp;</td>
<td><input name="UserName" type="text" value="<%=session("usr_name")%>" size="20" maxlength="100"></td>
</tr>
<tr>
<td align="right" height="35">เวลาที่เริ่มการค้นหา:&nbsp;&nbsp;</td>
<td><input name="TimeStart" type="text" value="<%response.write Time ()%>" size="20" maxlength="100"></td>
</tr>
<tr>
<td align="right" height="35">เวลาที่หยุดการค้นหา:&nbsp;&nbsp;</td>
<td><input name="TimeStop" type="text" value="<%=strTimeStop%>" size="20" maxlength="100"></td>
</tr>
<tr>
<td align="right" height="35">เวลาที่ใช้ในการค้นหาทั้งหมด:&nbsp;&nbsp;</td>
<td><input name="TimeTotal" type="text" value="<%=strTimeTotal%>" size="20" maxlength="100"></td>
</tr>
</table>
<p align="center">
<%if tmpmode="add" then%>
&nbsp;<input type="submit" name="actionmode" value=" บันทึก " >
<%elseif tmpmode="edit" then%>
&nbsp;<input type="submit" name="actionmode" value=" ตกลง " >
<%elseif tmpmode="del" then%>
&nbsp;<input type="submit" name="actionmode" value=" ยืนยัน ">
<%end if%>
</p>
</form>
</BODY>
</HTML>







Date : 2010-01-26 11:56:43 By : numenoy
 


 

No. 2



โพสกระทู้ ( 10 )
บทความ ( 0 )



สถานะออฟไลน์


ขอบคุณมากคับ
Date : 2010-01-26 13:58:59 By : punkkydear
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยหน่อยครับ คือผมต้องการจับเวลานะคับ โดยการเริ่มก็กดปุ่ม start จะเซฟเวลาปัจจุบัน
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่