 |
|
Microsoft OLE DB Provider for ODBC Drivers (0x80040E0C)
Command text was not set for the command object.
/csd2/excel.asp, line 49
อันนี้คือcodeคะ
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body body bgcolor='yellow'>
<form action=excel.asp method='post'>
<table border=0 bidth='100%'>
<tr><td valign='top' width='25%'><input type='text' size=21 name='comp'></td>
<td width='45%'><input type='text' size=41 name='add'><br>
<input type='radio' checked name='op' value="1">บันทึก
<input type='radio' name='op' value='2'>แก้ไข</td>
<td valign="top" width="15%"><input type='text' size=12 name='tel'></td>
<td valign='top' width='15%' ><input type='submit' value="ส่งข้อมูล" ></td></tr></table></form>
<hr>
<%
Dim Wd(10),n
Wd(0)=35:Wd(1)=35:Wd(2)=30
Set Obj=Server.CreateObject("ADODB.Connection")
Obj.Open "FileDSN=dsnfiexcel.dsn"
if Request.Form("comp")<>"" then
v1=Request.Form("comp")
v2=Request.Form("add")
v3=Request.Form("tel")
cs=Request.Form("op")
select case cs
case 2
'ส่วนแก้ไข
Sqlstr="Update hptal set road='"&v2&"',Tel='"&v3&"' where name='"&v1&"' "
set Rsadd=obj.Execute(Sqlstr)
Set Rsadd=Nothing
case 1
'ส่วนบันทึก
set Cmd=Server.CreatObject("ADODB.Command")
Cmd.ActiveConnection = Obj
Cmd.CommandText ="INSERT INTO hptal (name,road,tel) values (?,?,?)"
Set objparam=Cmd.createparameter(, 200, , 102, v1)
Cmd.parameters.append objparam
Set objparam=Cmd.createparameter(, 200, , 102, v2)
Cmd.parameters.append objparam
Set objparam=Cmd.createparameter(, 200, , 102, v3)
Cmd.parameters.append objparam
Cmd.Execute
Set Cmd=Nothing
End select
End if
'ส่วนแสดงรายการข้อมูล
Set RsLst=Obj.Execute(tptal) ----------------------------------------------------------------------- บรรทัดที่ 49 คะ
Response.Write "<table border=0 width='100%'>"
Do Until RsLst.Eof
Response.Write "<tr>"
For j=0 to RsLst.Fields.Count-1
Response.Write "<td width='"&Wd(j)&"%'>"&RsLst.Fields(j).value&"</td>"
next
Response.Write "</tr>"
RsLst.MoveNext
Loop
Response.Write "</table>"
RsLst.Close
Obj.Close
Set RsLst=Nothing
Set Obj=Nothing
%>
</body>
</html>
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
30 ม.ค. 2550 16:07:59 |
By :
ดา |
View :
4055 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |