Forums
This topic is locked
Insert Data into DB
Posted 21 Jul 2003 10:09:32
1
has voted
21 Jul 2003 10:09:32 NaiWah Lui posted:
hiHow do I insert Data in to DB without using forms. For example in my code:
Customer = request.querystring("CustomerID"

How do i use the variable Customer to insert data into DB? I have tried using Insert Command but it didn't work.
thanks
Replies
Replied 21 Jul 2003 11:54:01
21 Jul 2003 11:54:01 Vince Baker replied:
Here is a template of what you need for the insert action.
<%
sql ="INSERT INTO TABLE_NAME (Field_name, Field_name2) VALUES ('" & str & "','" & str & "')"
%>
<%
set InsertRecords = Server.CreateObject("ADODB.Command"
InsertRecords.ActiveConnection = MM_CONN_NAME_STRING
InsertRecords.CommandText = sql
InsertRecords.CommandType = 1
InsertRecords.CommandTimeout = 0
InsertRecords.Prepared = true
InsertRecords.Execute()
%>
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
<%
sql ="INSERT INTO TABLE_NAME (Field_name, Field_name2) VALUES ('" & str & "','" & str & "')"
%>
<%
set InsertRecords = Server.CreateObject("ADODB.Command"

InsertRecords.ActiveConnection = MM_CONN_NAME_STRING
InsertRecords.CommandText = sql
InsertRecords.CommandType = 1
InsertRecords.CommandTimeout = 0
InsertRecords.Prepared = true
InsertRecords.Execute()
%>
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting