|
 |
asp_databases thread: WEIRD ERROR!!! Command text was not set for the command object.
Message #1 by "Lan Chi Tran" <lanchi1975@y...> on Thu, 26 Jul 2001 20:46:23
|
|
Hi Peter,
I made all the changes and I am encountered into another problem which I
just posted a few minutes ago with the title (Command text was not set for
the command object).
Please look at my CREATEENTRIES.ASP, especially at my text box when I name
it as well as my CREATE_RESPONSE_ENTRIES.ASP at (set rstemp=objConn.execute
(SQLstr)). Thanks again. I am looking at your codes again to see if I
can find out something else that goes wrong.
Also, please look at my ADODB connection and Recordset. They look like
puzzle to me.
Very appreciated for your kind help.
************************
CREATEENTRIES.ASP
************************
<%
Dim objConn, myDSN, SQL, rstemp
myDSN="DSN=testdata;UID=sa"
set objConn=server.createobject("adodb.connection")
objConn.open myDSN
SQL="Select * from STANDARDS"
set rstemp=objConn.execute(SQL)
%>
<table border=1 CELLPADDING='2' BGCOLOR='#D5D0DF'>
<H3>Please fill out this form.</H3><tr>
<%
for each frmItem in rstemp.fields
Response.write(" <TR><TD><b>")
Response.write(frmItem.name)
Response.write("</b></TD><TD><INPUT TYPE='TEXT' name=")
Response.write(frmItem.name)
Response.write("'></TD></TR>")
next
%>
</table>
<%
rstemp.close
set rstemp=nothing
objConn.close
set objConn=nothing
%>
<P>
<TR><TD><INPUT TYPE=3D"SUBMIT" VALUE=3D"CREATE ENTRIES">
</TD>
<TD><INPUT TYPE=RESET VALUE=RESET></TD>
</TR>
</form></TABLE>
*************************
RESPONSE_CREATE_ENTRIES.ASP
**************************
<%
dim objConn, rs, names, values, SQL, SQLstr, rstemp
Set objConn = Server.CreateObject ("ADODB.Connection")
objConn.Open "testdata"
set rstemp=objConn.execute(SQLstr)
SQLFields = ""
SQLValues = ""
For each frmItem in Request.Form
SQLFields = SQLFields & ", " & intNumItems
SQLValues = SQLValues & ", '" & Request.Form(intNumItems) & "'"
Next
SQLFields = mid(SQLFields, 3)
SQLValues = mid(SQLValues, 3)
SQLstr = "INSERT INTO Standards (" & SQLFields & ") VALUES (" & values
& ")"
objconn.execute(SQLstr)
rstemp.close
set rstemp=nothing
objconn.close
set objconn = nothing
%>
</form>
</table>
**********************************8
Message #2 by "Grant I" <giswim1@a...> on Thu, 26 Jul 2001 22:12:50
|
|
Please don't create new threads for the same subject. You now have 4
threads about the same problem. Just continue the thread and most of us
look at them when we see the number of replies increase. The caps and
excessive exclamation points are not needed either. When you create a new
thread it pushes all previous ones down a spot and sends the last current
one to the archive.
Thanks
Grant
> Hi Peter,
>
> I made all the changes and I am encountered into another problem which I
> just posted a few minutes ago with the title (Command text was not set
for
> the command object).
>
> Please look at my CREATEENTRIES.ASP, especially at my text box when I
name
> it as well as my CREATE_RESPONSE_ENTRIES.ASP at (set
rstemp=objConn.execute
> (SQLstr)). Thanks again. I am looking at your codes again to see if I
> can find out something else that goes wrong.
>
> Also, please look at my ADODB connection and Recordset. They look like
> puzzle to me.
>
> Very appreciated for your kind help.
> ************************
> CREATEENTRIES.ASP
> ************************
> <%
> Dim objConn, myDSN, SQL, rstemp
> myDSN="DSN=testdata;UID=sa"
> set objConn=server.createobject("adodb.connection")
> objConn.open myDSN
> SQL="Select * from STANDARDS"
> set rstemp=objConn.execute(SQL)
> %>
> <table border=1 CELLPADDING='2' BGCOLOR='#D5D0DF'>
> <H3>Please fill out this form.</H3><tr>
> <%
> for each frmItem in rstemp.fields
> Response.write(" <TR><TD><b>")
> Response.write(frmItem.name)
> Response.write("</b></TD><TD><INPUT TYPE='TEXT' name=")
> Response.write(frmItem.name)
> Response.write("'></TD></TR>")
> next
> %>
> </table>
> <%
> rstemp.close
> set rstemp=nothing
> objConn.close
> set objConn=nothing
> %>
> <P>
> <TR><TD><INPUT TYPE=3D"SUBMIT" VALUE=3D"CREATE ENTRIES">
> </TD>
> <TD><INPUT TYPE=RESET VALUE=RESET></TD>
> </TR>
> </form></TABLE>
> *************************
> RESPONSE_CREATE_ENTRIES.ASP
> **************************
> <%
> dim objConn, rs, names, values, SQL, SQLstr, rstemp
>
> Set objConn = Server.CreateObject ("ADODB.Connection")
> objConn.Open "testdata"
>
> set rstemp=objConn.execute(SQLstr)
>
> SQLFields = ""
> SQLValues = ""
>
> For each frmItem in Request.Form
> SQLFields = SQLFields & ", " & intNumItems
> SQLValues = SQLValues & ", '" & Request.Form(intNumItems) & "'"
> Next
>
> SQLFields = mid(SQLFields, 3)
> SQLValues = mid(SQLValues, 3)
>
>
> SQLstr = "INSERT INTO Standards (" & SQLFields & ") VALUES (" & values
> & ")"
>
> objconn.execute(SQLstr)
> rstemp.close
> set rstemp=nothing
> objconn.close
> set objconn = nothing
>
> %>
> </form>
> </table>
> **********************************8
|
|
 |