Forums

This topic is locked

Creating an extension to insert record

Posted 03 Jan 2004 22:30:24
1
has voted
03 Jan 2004 22:30:24 jason zimmer posted:
I am trying to create a server behavior to insert a record into a database of the user's choice. How should I allow the user to connect to the database? How should I insert the record?

I think using an <i>ADODB.Command</i> is best, but how do I insert the <b>&lt;!--#include file="Connections/test.asp" --&gt;</b> code to point to the user defined connection? I also have to somehow determine the "ActiveConnection" for the below <i>ADODB.Command</i>. Any thoughts?

set Command1 = Server.CreateObject("ADODB.Command"
Command1.ActiveConnection = <b>MM_test_STRING</b>
Command1.CommandText = "INSERT INTO ( ) VALUES ( ) "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()

Replies

Replied 05 Jan 2004 13:04:58
05 Jan 2004 13:04:58 Vince Baker replied:
Creating a dynamic include file is very difficult as the include file cannot contain a database variable.....

You can do this however using the sysFileObject method, this opens a file and then you can extract the content of the connection file.

Here is a link to an explanation of how to do it...

www.asp101.com/articles/michael/dynamicincludes/default.asp

Regards
Vince

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 05 Jan 2004 19:14:20
05 Jan 2004 19:14:20 jason zimmer replied:
Thanks, but what I'm trying to do is use Dreamweaver's server behavior UI to capture a user's choice for a database connection, then place that info into the script that the server behavior is putting into the user's page.

Reply to this topic