 |
|
ค้นหาไม่ได้ค่ะ ช่วยดูให้หน่อยค่ะ คือ เอาโค้ดคนอื่นมาดูต่อค่ะ แล้วก้องง มันค้นหาไม่ได้ พอกดปุ่มค้นหาแล้วไม่โชว์ผลลัพธ์น่ะค่ะ |
|
 |
|
|
 |
 |
|
คือ เอาโค้ดคนอื่นมาดูต่อค่ะ แล้วก้องง
มันค้นหาไม่ได้ พอกดปุ่มค้นหาแล้วไม่โชว์ผลลัพธ์น่ะค่ะ
<%
session("searchdata") = request("searchdata")
If Request("searchdata") <> "" or session("searchdata") <> "" then
Countdetailst = 0
codedata1 = Request("codedata1")
codedata2 = Request("codedata2")
codedata3 = Request("codedata3")
codedata4 = Request("codedata4")
codedata5 = Request("codedata5") Countstdata = 0
Session("txtdatast3") = ""
Session("txtdatast4") = ""
Session("txtdatast5") = ""
If (Request("searchdata") = "ค้นหา") then
sql = ""
sql = "Select * From DLR_ORD_BKG,DLR_SLSM_MST,DSP_SRS_MST,DSP_MOD_MST,DSP_CLR_MST,DLR_SLSM_TEAM_MST,VSC_INV_INFO "
sql = sql & " Where DLR_ORD_BKG.DOB_SLSM_CD = DLR_SLSM_MST.SLM_SLSM_CD "
sql = sql & " and DLR_ORD_BKG.DOB_SRS_CD = DSP_SRS_MST.SMT_SRS_CD "
sql = sql & " and DLR_ORD_BKG.DOB_SRS_CD = DSP_MOD_MST.MMT_SRS_CD "
sql = sql & " and DLR_ORD_BKG.DOB_MOD_CD = DSP_MOD_MST.MMT_MOD_CD "
sql = sql & " and DLR_ORD_BKG.DOB_MOD_SFX = DSP_MOD_MST.MMT_MOD_SFX "
sql = sql & " and DLR_ORD_BKG.DOB_CLR_CD = DSP_CLR_MST.CMT_CLR_CD"
sql = sql & " and DLR_SLSM_MST.SLM_TEAM_CD = DLR_SLSM_TEAM_MST.STM_TEAM_CD "
sql = sql & " and DLR_ORD_BKG.DOB_VIN_NO = VSC_INV_INFO.IVI_VIN_NO "
If ( codedata1<> "") then
sql = sql & " and DOB_SRS_CD = '" & codedata1& "' "
End if
If ( codedata2 <> "") then
If (len(codedata2) >= 20) then
codedata2_srs = Left(codedata2,instr(codedata2,"#")-1)
codedata2_Md = mid(codedata2,instr(codedata2,"#")+1,18)
codedata2_model = mid(codedata2_Md,1,instr(codedata2_Md,"|")-1)
codedata2_sfx = mid(codedata2_Md,instr(codedata2_Md,"|")+1,2)
End If
If ( codedata2_srs <> "") then
sql = sql & " and DOB_SRS_CD = '" &codedata2_srs& "' "
End If
If ( codedata2_model <> "") then
sql = sql & " and DOB_MOD_CD = '" &codedata2_model& "' "
End If
If ( codedata2_sfx <> "") then
sql = sql & " and DOB_MOD_SFX = '" &codedata2_sfx& "' "
End If
End if
If ( codedata3<> "") then
sql = sql & " and DOB_CLR_CD = '" & codedata3& "' "
End if
If ( codedata4<> "") then
sql = sql & " and STM_TEAM_CD = '" & codedata4& "' "
End if
If ( codedata5<> "") then
sql = sql & " and DOB_SLSM_CD = '" & codedata5& "' "
End if
sql = sql & " Order by DOB_SRS_CD,DOB_MOD_CD,DOB_MOD_SFX,DOB_CLR_CD"
set rs = conn.execute(sql)
do while not rs.eof
Countstdata = Countstdata + 1
Session("txtdatast3") = rs("SMT_SRS_NM")
Session("txtdatast4") = rs("MMT_DESC")
Session("txtdatast5") = rs("CMT_CLR_CD")&" - "&rs("CMT_CLR_NM")
Response.Write " <tr> "
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"&CStr(Countstdata)&"</div></td>"
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"&rs("DOB_BKG_NO")&"</div></td>"
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"& rs("DOB_BKG_DT") &"</div></td>"
Response.Write "<td bgcolor=""#EFEFEF""><div align=""Left"">"&rs("SLM_SLSM_FST_NM")&" "&rs("SLM_SLSM_FMALY_NM")&"</div></td>"
If (rs("DOB_SRE_TY") = "1") then
txtdatast1 = "Ordinary"
ElseIF (rs("DOB_SRE_TY") = "2") then
txtdatast1 = "Fleet"
End If
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"&txtdatast1&"</div></td>"
If (rs("DOB_BKG_STS_CD") = "W") Or (rs("DOB_BKG_STS_CD") = "w") then
txtdatast2 = "รอการอนุมัติ"
ElseIF (rs("DOB_BKG_STS_CD") = "A") Or (rs("DOB_BKG_STS_CD") = "a") then
txtdatast2 = "อนุมัติ"
ElseIF (rs("DOB_BKG_STS_CD") = "F") Or (rs("DOB_BKG_STS_CD") = "f") then
txtdatast2 = "จัดไฟแนนซ์ผ่าน"
ElseIF (rs("DOB_BKG_STS_CD") = "M") Or (rs("DOB_BKG_STS_CD") = "m") then
txtdatast2 = "จัดสรรรถยนต์"
ElseIF (rs("DOB_BKG_STS_CD") = "S") Or (rs("DOB_BKG_STS_CD") = "s") then
txtdatast2 = "มีกำหนดวันที่ออกรถ"
ElseIF (rs("DOB_BKG_STS_CD") = "R") Or (rs("DOB_BKG_STS_CD") = "r") then
txtdatast2 = "ส่งมอบรถ"
ElseIF (rs("DOB_BKG_STS_CD") = "G") Or (rs("DOB_BKG_STS_CD") = "g") then
txtdatast2 = "ยกเลิกใบจอง"
ElseIF (rs("DOB_BKG_STS_CD") = "D") Or (rs("DOB_BKG_STS_CD") = "d") then
txtdatast2 = "ไ่ม่ดำเนินการใดๆ"
End If
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"&txtdatast2&"</div></td>"
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"&rs("DOB_VIN_NO")&"</div></td>"
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"&rs("IVI_INV_DT")&"</div></td>"
Response.Write "</tr>"
rs.movenext
loop
set rs = nothing
End IF
%>
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
23 ส.ค. 2549 11:28:51 |
By :
เพรียว |
View :
2059 |
Reply :
6 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลืมบอกไปว่าดูโค้ดไม่ค่อยรู้เรื่องถ้าจะกรุณามาก ๆ อธิบายให้ด้วยก็ดีมากๆค่ะ ขอบคุนล่วงหน้าค่ะ
|
 |
 |
 |
 |
Date :
23 ส.ค. 2549 11:36:56 |
By :
เพรียว |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ที่ไม่แสดงผลนี่ขึ้น message error หรือเปล่าคะ หรือว่าไม่แสดงข้อมูลอะไรเลย
|
 |
 |
 |
 |
Date :
23 ส.ค. 2549 12:25:17 |
By :
มักกะโรนีกะหมากเก็บ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่แสดงข้อมูลอะไรเรยค่ะ gxho asp ธรรมดาค่ะ ไม่มี msgbox
|
 |
 |
 |
 |
Date :
23 ส.ค. 2549 12:53:07 |
By :
เพรียว |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ถ้าอย่างนั้นลอง response.write sql ออกมานะคะ คิดว่าถ้าไม่มี error message อาจจะเกิดจากใน database นั้นไม่มีข้อมูลอที่ตรงกับเงื่อนไขของ where น่ะค่ะ
|
 |
 |
 |
 |
Date :
23 ส.ค. 2549 13:51:27 |
By :
มักกะโรนีกะหมากเก็บ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
น่าจะพอช่วยได้บ้างนะคะ
<%
' เป็นการรับค้ามาจาก form อื่นโดยทำการเก็บค่าตัวแปรเอาไว้ใน session
session("searchdata") = request("searchdata")
'ตรวจสอบว่าตัวแปรที่ส่งมามีค่าหรือไม่
If Request("searchdata") <> "" or session("searchdata") <> "" then
Countdetailst = 0
' ถ้ามีค่าก็เก็บค่า เช่น codedata1, codedata 2 เอาไว้ในตัวแปร
' คำสั่ง request("") เป็นการรับค่ามาจาก form อื่น
codedata1 = Request("codedata1")
codedata2 = Request("codedata2")
codedata3 = Request("codedata3")
codedata4 = Request("codedata4")
codedata5 = Request("codedata5") Countstdata = 0
Session("txtdatast3") = ""
Session("txtdatast4") = ""
Session("txtdatast5") = ""
' ตรวจสอบว่าค่าของตัวแปร searchdata = ค้นหา ใช่หรือไม่ (คิดว่าตัวแปร searchdata น่าจะเป็นปุ่ม submit โดยที่ value = 'ค้นหา')
If (Request("searchdata") = "ค้นหา") Then
' ถ้าใช่ก็ให้มาทำการ select ข้อมูลจาก database
sql = ""
sql = "Select * From DLR_ORD_BKG,DLR_SLSM_MST,DSP_SRS_MST,DSP_MOD_MST,DSP_CLR_MST,DLR_SLSM_TEAM_MST,VSC_INV_INFO "
sql = sql & " Where DLR_ORD_BKG.DOB_SLSM_CD = DLR_SLSM_MST.SLM_SLSM_CD "
sql = sql & " and DLR_ORD_BKG.DOB_SRS_CD = DSP_SRS_MST.SMT_SRS_CD "
sql = sql & " and DLR_ORD_BKG.DOB_SRS_CD = DSP_MOD_MST.MMT_SRS_CD "
sql = sql & " and DLR_ORD_BKG.DOB_MOD_CD = DSP_MOD_MST.MMT_MOD_CD "
sql = sql & " and DLR_ORD_BKG.DOB_MOD_SFX = DSP_MOD_MST.MMT_MOD_SFX "
sql = sql & " and DLR_ORD_BKG.DOB_CLR_CD = DSP_CLR_MST.CMT_CLR_CD"
sql = sql & " and DLR_SLSM_MST.SLM_TEAM_CD = DLR_SLSM_TEAM_MST.STM_TEAM_CD "
sql = sql & " and DLR_ORD_BKG.DOB_VIN_NO = VSC_INV_INFO.IVI_VIN_NO "
' check ว่าเขาได้ใส่เงืื่อนไขในการค้นหาข้อมูลของเงื่อนไขที่ 1 หรือเปล่า ถ้าใช่ต้องเอามาใส่ในเงื่อนไข where
If ( codedata1<> "") then
sql = sql & " and DOB_SRS_CD = '" & codedata1& "' "
End If
' check ว่าเขาได้ใส่เงืื่อนไขในการค้นหาข้อมูลของเงื่อนไขที่ 2 หรือเปล่า ถ้าใช่ต้องเอามาใส่ในเงื่อนไข where
If ( codedata2 <> "") Then
If (len(codedata2) >= 20) then
codedata2_srs = Left(codedata2,instr(codedata2,"#")-1)
codedata2_Md = mid(codedata2,instr(codedata2,"#")+1,18)
codedata2_model = mid(codedata2_Md,1,instr(codedata2_Md,"|")-1)
codedata2_sfx = mid(codedata2_Md,instr(codedata2_Md,"|")+1,2)
End If
If ( codedata2_srs <> "") then
sql = sql & " and DOB_SRS_CD = '" &codedata2_srs& "' "
End If
If ( codedata2_model <> "") then
sql = sql & " and DOB_MOD_CD = '" &codedata2_model& "' "
End If
If ( codedata2_sfx <> "") then
sql = sql & " and DOB_MOD_SFX = '" &codedata2_sfx& "' "
End If
End if
If ( codedata3<> "") then
sql = sql & " and DOB_CLR_CD = '" & codedata3& "' "
End if
If ( codedata4<> "") then
sql = sql & " and STM_TEAM_CD = '" & codedata4& "' "
End if
If ( codedata5<> "") then
sql = sql & " and DOB_SLSM_CD = '" & codedata5& "' "
End if
sql = sql & " Order by DOB_SRS_CD,DOB_MOD_CD,DOB_MOD_SFX,DOB_CLR_CD"
' ทำการ connect กับ database
set rs = conn.execute(sql)
' check เงื่อนไขของ loop ในกรณีที่ข้อมูลที่เรา select ออกมามีหลายเรคคอร์ด
'ในขณะที่ยังไม่หมดเรคคอร์ด
do while not rs.eof
Countstdata = Countstdata + 1
' เก็บค่าของข้อมูลที่ดึงมาจากฐานข้อมูลลงในตัวแปร session
Session("txtdatast3") = rs("SMT_SRS_NM")
Session("txtdatast4") = rs("MMT_DESC")
Session("txtdatast5") = rs("CMT_CLR_CD")&" - "&rs("CMT_CLR_NM")
' แสดงค่าออกมาโดยใส่ในตารางของ html
Response.Write " <tr> "
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"&CStr(Countstdata)&"</div></td>"
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"&rs("DOB_BKG_NO")&"</div></td>"
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"& rs("DOB_BKG_DT") &"</div></td>"
Response.Write "<td bgcolor=""#EFEFEF""><div align=""Left"">"&rs("SLM_SLSM_FST_NM")&" "&rs("SLM_SLSM_FMALY_NM")&"</div></td>"
' ข้างล่างก็เป็นการ check เงื่อนไขของข้อมูลที่ select ได้ โดยถ้าตรงกับเงื่อนไขของ if ที่เรากำหนดก็ให้เก็บค่าที่เราต้องการไว้ในตัวแปร
If (rs("DOB_SRE_TY") = "1") then
txtdatast1 = "Ordinary"
ElseIF (rs("DOB_SRE_TY") = "2") then
txtdatast1 = "Fleet"
End If
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"&txtdatast1&"</div></td>"
If (rs("DOB_BKG_STS_CD") = "W") Or (rs("DOB_BKG_STS_CD") = "w") then
txtdatast2 = "รอการอนุมัติ"
ElseIF (rs("DOB_BKG_STS_CD") = "A") Or (rs("DOB_BKG_STS_CD") = "a") then
txtdatast2 = "อนุมัติ"
ElseIF (rs("DOB_BKG_STS_CD") = "F") Or (rs("DOB_BKG_STS_CD") = "f") then
txtdatast2 = "จัดไฟแนนซ์ผ่าน"
ElseIF (rs("DOB_BKG_STS_CD") = "M") Or (rs("DOB_BKG_STS_CD") = "m") then
txtdatast2 = "จัดสรรรถยนต์"
ElseIF (rs("DOB_BKG_STS_CD") = "S") Or (rs("DOB_BKG_STS_CD") = "s") then
txtdatast2 = "มีกำหนดวันที่ออกรถ"
ElseIF (rs("DOB_BKG_STS_CD") = "R") Or (rs("DOB_BKG_STS_CD") = "r") then
txtdatast2 = "ส่งมอบรถ"
ElseIF (rs("DOB_BKG_STS_CD") = "G") Or (rs("DOB_BKG_STS_CD") = "g") then
txtdatast2 = "ยกเลิกใบจอง"
ElseIF (rs("DOB_BKG_STS_CD") = "D") Or (rs("DOB_BKG_STS_CD") = "d") then
txtdatast2 = "ไ่ม่ดำเนินการใดๆ"
End If
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"&txtdatast2&"</div></td>"
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"&rs("DOB_VIN_NO")&"</div></td>"
Response.Write "<td bgcolor=""#EFEFEF""><div align=""center"">"&rs("IVI_INV_DT")&"</div></td>"
Response.Write "</tr>"
' เลื่อนไปยังเรคคอร์ดต่อไป
rs.movenext
loop
set rs = nothing
End IF
%>
|
 |
 |
 |
 |
Date :
23 ส.ค. 2549 14:14:32 |
By :
มักกะโรนีกะหมากเก็บ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุนนะคะคุณมักกะโรนีกะหมากเก็บ
|
 |
 |
 |
 |
Date :
23 ส.ค. 2549 16:44:08 |
By :
เพรียว |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|