Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Rookie Needs Help

Status
Not open for further replies.

JrClown

Technical User
Oct 18, 2000
393
US

Hello all, I hope everyone's having a great day\morning\afternoon depending on where you are.

Being faily new to ASP's Pages, I have encountered a problem with a form I'm building from scratch. I'm currently reading "ASP for Dums-***" like me and I'm having a problem with my form not adding records to my database. here's the code

<%
SQL=&quot;INSERT INTO names (first, last, title, department, extension, cellular, pager, rcode) Values (&quot;&amp;_
&quot;'&quot;&amp; request.form(&quot;first&quot;)&amp; &quot;', &quot; &amp; _
&quot;'&quot;&amp; request.form(&quot;last&quot;)&amp; &quot;', &quot; &amp; _
&quot;'&quot;&amp; request.form(&quot;title&quot;)&amp; &quot;', &quot; &amp; _
&quot;'&quot;&amp; request.form(&quot;department&quot;)&amp; &quot;', &quot; &amp;_
&quot;'&quot;&amp; request.form(&quot;extension&quot;)&amp; &quot;', &quot; &amp;_
&quot;'&quot;&amp; request.form(&quot;cellular&quot;)&amp; &quot;', &quot; &amp;_
&quot;'&quot;&amp; request.form(&quot;pager&quot;)&amp; &quot;', &quot; &amp;_
&quot;'&quot;&amp; request.form(&quot;rcode&quot;)&amp; &quot;')&quot;
dim myconnect
set myconnect=server.createobject(&quot;adodb.recordset&quot;)
myconnect.open sql, &quot;dsn=phones&quot;
%>
If anyone sees a problem, let me know. Thanks

















QUOTE OF THE DAY
Everyone you meet knows something you don't know. Be willing to learn from them.

Jr_Clown :eek:)
 
Jr_Clown,

To 'execute' an INSERT SQL Statement do this:

set myconnect=server.createobject(&quot;adodb.connection&quot;)
myconnect.open &quot;dsn=phones&quot;
myconnect.execute sql

Hope this helps
-pete

 


Thanks for your input Pete. Now, I'm getting this error
*********************************************************
Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'execute'

/vacation/insertscript.asp, line 31
*********************************************************

myconnect.execute sql <-------- This is line 31

QUOTE OF THE DAY
Everyone you meet knows something you don't know. Be willing to learn from them.

Jr_Clown :eek:)
 
JR_Clown,

usually i'd

1)trap the submitted for data(ie.request.form(&quot;first&quot;)) into variables - ie.first_v
2)instantiate a connection, open the connection like this:
conn.Open &quot;db&quot;,&quot;user&quot;,&quot;pwd&quot;
3)build sql string
strSQLAdd = &quot;INSERT into billing_detail(xxxx) Values(first_v)
4)Execute the sql:
conn.Execute(strSQLAdd)
5)close connection
6)set connection to Nothing


hope this helps a bit
 

Thanks for you help fellas. ;-)

QUOTE OF THE DAY
Everyone you meet knows something you don't know. Be willing to learn from them.

Jr_Clown :eek:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top