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,027

HOME > ASP > ASP Forum > ติด Cannot use Request.Form collection after calling BinaryRead. ต้องแก้ยังไงครับ



 

ติด Cannot use Request.Form collection after calling BinaryRead. ต้องแก้ยังไงครับ

 



Topic : 072033

Guest




มันแจ้งว่าเราติด

Code
Request object error 'ASP 0207 : 80004005'

Cannot use Request.Form

/test/user/insertnews.asp, line 81

Cannot use Request.Form collection after calling BinaryRead.

ต้องแก้ยังไงครับ ขอละเอียดนิดหนึ่งนะครับ เพราะผมต้องรีบใช้แล้วอ่ะ

Form(ASP)
<%
if Session("user")="" then
	Response.Redirect("../login.asp")
end if
%>
<!--#include file="userheader.asp"-->
<!--#include file="usermenu.asp"-->

<td class="f2">

<script language="javascript">
Function init()
{
	if (document.innew.txttile.value == "")
	{
		alert("กรุณาใส่หัวข้อข่าวด้วย");
		document.innew.txttile.focus();
		return false;
	}
	if (document.innew.txtdetail.value == "")
	{
		alert("กรุณาใส่รายละเอียดด้วยด้วย");
		document.innew.txtdetail.focus();
		return false;
	}
	if (document.innew.txttype.value == "")
	{
		alert("กรุณาใส่ส่วนงานด้วย");
		document.innew.txttype.focus();
		return false;
	}
	
	document.innew.sumbit();
	
}
</script>

<form action="insertnews.asp"  method="post" name="innew" onsubmit="return init()" enctype="multipart/form-data" >
<table width="80%" border="1" style="width:50%">
	<th colspan="2" align="center"> เพิ่มข่าวใหม่</th>
    <tr>
    	<td valign="top">หัวข้อข่าว</td>
        <td><input name="txttitle" type="text" size="80" /> </td>
    </tr>
    <tr>
    	<td valign="top">รายละเอียดข่าว</td>
        <td><textarea name="txtdetail" cols="80" rows="5"></textarea></td>
    </tr>
     <tr>
    	<td valign="top">ส่วนประกาศ</td>
        <td><select name="txtcall">  
       	   <option value="ข่าวประชาสัมพันธ์" selected="selected">ข่าวประชาสัมพันธ์</option>
          <option value="ข่าวประกาศ">ข่าวประกาศ</option>
          <option value="ข่าวการศึกษาก่อนปริญญา">ข่าวการศึกษาก่อนปริญญา</option>
          <option value="ข่าวการศึกษาหลังปริญญา">ข่าวการศึกษาหลังปริญญา</option>
        </select></td>
    </tr>
    <tr>
    	<td valign="top">หมายเหตุ</td>
        <td><input name="txtetc" type="text" size="80" /> </td>
    </tr>
    <tr>
    	<td valign="top">ส่วนงาน</td>
        <td><select name="txttype">  
          <option value="" selected="selected">กรุณาเลือก</option>
          <%
		  dim sqltype,rectype
		  sqltype="select * from unit "
		  set rectype=Server.CreateObject("ADODB.Recordset")
		  rectype.open sqltype,con
		  while not rectype.EOF
		  %>
          <option value="<%=rectype.fields("unitid").value%>" ><%=rectype.fields("unitname").value%></option>
          <%
		  rectype.movenext
		  wend
		  rectype.close()
		  set rectype=nothing
		  %>
        </select> </td>
    </tr>
    <tr>
    	<td valign="top">เอกสารแนบ</td>
        <td><input name="file1"type="file" size="80" /> </td>
    </tr>
     <tr>
    	<td colspan="2" align="center">
        <input name="submit" type="submit" value="บันทึก" />
        <input name="Reset" type="reset" value="ยกเลิก" />
        </td>
    </tr>
</table>
</form>
</td>
</tr>
</table>

<!--#include file="footer.asp" -->


upload(ASP)
<!--#include file="connect.asp"-->
<%

Dim mySmartUpload

	'*** Create Object ***'	
	Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

	'*** Upload Files ***'
	mySmartUpload.Upload

	
	'*** Upload file1 ***'
	If mySmartUpload.Files("file1").FileName <> "" Then
		mySmartUpload.Files("file1").SaveAs(Server.MapPath("uploads/" & mySmartUpload.Files("file1").FileName))
		'Response.write mySmartUpload.Files("file1").Name & " Uploaded."
	End If
	
	'*** Upload file2 ***'
	'If mySmartUpload.Files("file2").FileName <> "" Then
	'	mySmartUpload.Files("file2").SaveAs(Server.MapPath("uploads/" & 'mySmartUpload.Files("file2").FileName))
	'	Response.write mySmartUpload.Files("file2").Name & " Uploaded."
	'End IF

	'*** Properties ***'
	'Response.Write("Name = " & mySmartUpload.Files("file1").Name & "<BR>")
	'Response.Write("Size = " & mySmartUpload.Files("file1").Size & "<BR>")
	'Response.Write("FileName = " & mySmartUpload.Files("file1").FileName & "<BR>")
	'Response.Write("FileExt = " & mySmartUpload.Files("file1").FileExt & "<BR>")
	'Response.Write("FilePathName = " & mySmartUpload.Files("file1").FilePathName & "<BR>")
	'Response.Write("ContentType = " & mySmartUpload.Files("file1").ContentType & "<BR>")
	'Response.Write("ContentDisp = " & mySmartUpload.Files("file1").ContentDisp & "<BR>")
	'Response.Write("TypeMIME = " & mySmartUpload.Files("file1").TypeMIME & "<BR>")
	'Response.Write("SubTypeMIME = " & mySmartUpload.Files("file1").SubTypeMIME & "<BR>")


Function DateThai(strDate)
	Setlocale("en-us")
	Dim strDay,strMonth,strYear,strHour,strMinute,strSecond
	Dim arrMonth
	strDay = Day(strDate)
	strMonth = Month(strDate)
	strYear = Year(strDate)
	
	arrMonth = Array("เธก.เธ„.","เธ.เธž.","เธกเธต.เธ„","เน€เธก.เธฉ.","เธž.เธ„.","เธกเธด.เธข.","เธ.เธ„.","เธช.เธ„.","เธ.เธข.","เธ•.เธ„.","เธž.เธข.","เธ˜.เธ„.")	
	DateThai = strDay &" "&arrMonth(strMonth-1) &" "&strYear 
End Function

dim d,t
d=date()
t=DateThai(d)

Function  max(maxs)
	dim msql,mrec
	msql="select max(" & maxs & ") as idmax from news"
	set mrec=con.execute(msql)
	if not mrec.EOF then
		max=mrec.fields("idmax").value
	end if
End Function

dim idm,maxs
maxs="newsid"
idm=max(maxs)+1

Function  user(us)
	dim usel,urec
	usel="select * from officer where of_username='" & us & "' "
	set urec=con.execute(usel)
	if not urec.EOF then
		user=urec.fields("of_name").value
	end if
End Function

dim uses,us
us=Session("user")
uses=user(us)

dim uploads
uploads=

dim insql,inrec
insql="insert into news values ('" & idm & "','" & Request.Form("txttitle") & "','" & Request.Form("txtdetail") & "','" & Request.Form("txtcall") & "','" & mySmartUpload.Files("file1").FileName & "','" & Request.Form("txtetc ")& "','" & Request.Form("txttype ")& "','" & t & "','" & uses & "')"
set inrec=con.Execute(insql)
Response.Write(insql)
'response.Redirect("usernew.asp")

con.close()
urec.close()
mrec.close()
inrec.close()
set con= nothing
set inrec= nothing
Set mySmartUpload = Nothing
%>




Tag : ASP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-01-16 10:40:01 By : Clamore View : 1952 Reply : 7
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

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

คุณส่งไปแบบ Binary [enctype="multipart/form-data] ครับ อ่าน Request.Form ไม่ได้ครับ

ให้ใช้ mySmartUpload.Form("txt1") ครับ เช่น

Code (ASP)
mySmartUpload.Form("txttitle")


Go to : ASP aspSmartUpload - Upload and Other Element






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-16 11:19:34 By : webmaster
 


 

No. 2

Guest


insert into news values ('34','?????','sd','??????????','?????','33','freeASPUpload.zip','16 เน€เธ�เธ�.เน€เธ�ย�. 2012','10')

select * from officer where of_username='root'

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/test/user/insertnews.asp, line 96

ขึ้นยังงี้หมายความว่ายังไงอ่ะครับ

แล้วมีวิธีแก้ให้มันอ่านเป็นภาษาไทยไหมอ่ะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-16 13:08:27 By : Clamore
 

 

No. 3



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

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

Error Line ไหนครับ

ส่วนภาษาไทยควรกำหนด header เป็น

<meta http-equiv="Content-Type" content="text/html; charset=Windows-874">

และ aspSmartUpload ให้ใช้

Go to : #...มีปัญหากับ aspSmartupload มากๆ เลยค่ะ ในการรับค่าภาษาไทยและแสดงภาษาไทย
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-16 13:17:49 By : webmaster
 


 

No. 4

Guest


เออเรอไลที่ 96 อ่ะครับ
ส่วนโค้ดก็ตามข้างบนเลย
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-16 14:06:09 By : Clamroe
 


 

No. 5



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

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

ตอบความคิดเห็นที่ : 4 เขียนโดย : Clamroe เมื่อวันที่ 2012-01-16 14:06:09
รายละเอียดของการตอบ ::
เห็นมีแค่ 95 ครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-16 14:14:28 By : webmaster
 


 

No. 6

Guest


ตรง mrec.close() ครับ

ส่วน insert ผมก็ยัง อิน ไม่ได้ซักทีอ่ะ
ลองทั้ง session codepage ="874"
response charset="tis-620"
ก็ยังไม่ได้ซักทีอ่ะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-16 14:55:06 By : Clamore
 


 

No. 7



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

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

Code (ASP)
IF  IsObject(mrec) Then  mrec.close()

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-16 15:04:55 By : webmaster
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ติด Cannot use Request.Form collection after calling BinaryRead. ต้องแก้ยังไงครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 04
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 อัตราราคา คลิกที่นี่