 |
|
ช่วยด้วยครับ Error อย่างงี้แก้ยังไงครับ Microsoft VBScript runtime error: Object required: 'Obj' |
|
 |
|
|
 |
 |
|
Microsoft VBScript runtime error: Object required: 'Obj'
<!--#include file="ADOvbs.inc"-->
<html>
<body>
<form name="form1" method="post" action="sd.asp">
<div align="center"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong>ค้นหาจก
Department ID </strong>
<input type="text" name="keyword" value="<%=Request.Form("keyword")%>">
<input type="submit" name="Submit" value="ค้นหา">
</font></div>
</form>
<div align="center"> <font size="2" face="MS Sans Serif, Tahoma, sans-serif">
<%
if Request.Form("keyword")="" then
Response.write("<br>กรุณากรอก Keyword เพื่อค้นหาจาก Field Description<hr>")
else
Set ConnDB = Server.CreateObject("ADODB.Connection")
strConn = "Provider=SQLOLEDB; Server=SN_COM01; database=dbsn; UID=datadb; PWD=321654"
ConnDB.connectionstring = strConn
ConnDB.CursorLocation = 3
ConnDB.Open
Dim str_start : str_start = 5
Dim str_stop : str_stop = 10
strsql = "Select Departmentid,Corruption ,SectionID From Department where Departmentid like '%"&Request.Form("keyword")&"%'"
set rsObj = Server.CreateObject("ADODB.Recordset")
Obj.Open strsql, ConnDB, adOpenForWardOnly,AdLockReadOnly
If Not rsObj.EOF Then
arrRec = rsObj.getRows(,,Array("Departmentid", "Corruption", "SectionID"))
RecCount = Ubound(arrRec,2)+1
Else
RecCount = 0
End If
rsObj.close
Set rsObj = Nothing
for i=0 to ubound(arrRec,2)
Response.Write(arrRec(0, i))
next
If Rs.EOF Then
%>
<strong> ไม่มีข้อมูลในตาราง !</strong>
<%Else%>
</font>
<table width="608" height="48" border="1">
<tr bgcolor="Silver">
<td height="20"><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">Departmentid</font></strong></div></td>
<td><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">Corruption</font></strong></div></td>
<td><div align="center"><strong><font size="1" face="MS Sans Serif, Tahoma, sans-serif">SectionID</font></strong></div></td>
</tr>
<% While Not Rs.EOF%>
<tr>
<td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"><%= Rs("Departmentid")%></font></td>
<td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"><%= Rs("Corruption")%></font></td>
<td><font size="2" face="MS Sans Serif, Tahoma, sans-serif"><%= Rs("SectionID")%></font></td>
</tr>
<% Rs.MoveNext
Wend
Rs.Close
Conn.Close
End If
%>
</table>
<font size="2" face="MS Sans Serif, Tahoma, sans-serif">
<%
end if
%>
</font></div>
</body>
</html>
Obj.Open strsql, ConnDB, adOpenForWardOnly,AdLockReadOnly
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
9 ก.ค. 2551 22:30:32 |
By :
narongsr |
View :
1686 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Obj.Open strsql, ConnDB, adOpenForWardOnly,AdLockReadOnly
น่าจะเป็น
rsObj.Open strsql, ConnDB, adOpenForWardOnly,AdLockReadOnly
|
 |
 |
 |
 |
Date :
9 ก.ค. 2551 23:21:30 |
By :
อิอิ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใส่เป็น
rsObj.Open strsql, ConnDB, adOpenForWardOnly,AdLockReadOnly แล้วก็ยังรันไม่ออกครับ
แต่ดัน error บันทันนี้ครับ
If Rs.EOF Then
|
 |
 |
 |
 |
Date :
9 ก.ค. 2551 23:48:16 |
By :
narongsr |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คุณมั่วมาก คุณกลัวไปดูซะ Rs มันมาจากไหน แก้ยังงี้ก็ไม่ผ่านหรอก
|
 |
 |
 |
 |
Date :
10 ก.ค. 2551 09:06:59 |
By :
อิอิ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แนะนำหน่อยครับว่าจะแก้ตรงไหนครับ ผมมือใหม่หัดเขียนด้วยครับ
ขอบคุณครับ
|
 |
 |
 |
 |
Date :
10 ก.ค. 2551 16:32:43 |
By :
narongsr |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|