Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with ASP Insert Into Command

Explorer ,
Jan 15, 2008 Jan 15, 2008
Hi All,

I'm trying to get the following command (insert into) to work, but am having
no joy. I would be greatful if you could highlight what i have done wrong.
Its an for an ASP site using an MS SQL database -

<%

if(Session("BATCHID2") <> "") then insertaccountinvoice__MMColParam =
Session("BATCHID2")

if(Session("SITEID") <> "") then insertaccountinvoice__MMColParam2 =
Session("SITEID")

%>
<%
set insertaccountinvoice = Server.CreateObject("ADODB.Command")
insertaccountinvoice.ActiveConnection = MM_recruta2_STRING
insertaccountinvoice.CommandText = "INSERT INTO dbo.JBAccountInvoice
(JBACISiteID, JBACIClientID, JBACIAccountType, JBACIAccountOverwrite,
JBACIBillingContact, JBACIClientName, JBACIClientAddress, JBACIClientEmail,
JBACIBatchID) VALUES (dbo.JBClient(JBCLSiteID, JBCLID, JBCLAccountType,
JBCLreguserMonthlyOverwrite, JBCLBillingContact, JBCLName, JBCLAddress,
JBCLEmail ), " + Replace(insertaccountinvoice__MMColParam, "'", "''") + "
WHERE JBCLSiteID = '" + Replace(insertaccountinvoice__MMColParam2, "'", "''")
+ "' and JBCLAccountLive = 'y' and (JBCLAccountType = 'Reg User' OR
JBCLAccountType = 'Reg User5' OR JBCLAccountType = 'Reg User10' OR
JBCLAccountType = 'Multi User')) "
insertaccountinvoice.CommandType = 1
insertaccountinvoice.CommandTimeout = 0
insertaccountinvoice.Prepared = true
insertaccountinvoice.Execute()
%>
<% Response.Redirect(" http://www.recruta.co.uk") %>
TOPICS
Server side applications
311
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 15, 2008 Jan 15, 2008
LATEST
In general, the syntax for this kind of insert is:

insert into t1 (a,b,c)
select a,b,c from t2 where a=5

--
Jules
http://www.charon.co.uk/products.aspx
Charon Cart
Ecommerce for ASP/ASP.NET



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines