dbTalk Databases Forums  

Insert records via activex script

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Insert records via activex script in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Spud_Monkey
 
Posts: n/a

Default Insert records via activex script - 01-16-2004 , 03:55 AM






Hi

Could anyone please show me some sample code on how to insert a record into
a table via vbscript in an activex module.

Cheers



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Insert records via activex script - 01-16-2004 , 04:25 AM






Before I show you one method of doing this I would have to ask why?

Using a DataPump is invariably quicker.

Here is your code.

dim db
dim cnString

set db = CREATEOBJECT("ADODB.Connection")
cnString = "Provider=SQLOLEDB;Data Source=MySQLServer;Integrated
Security=SSPI;Initial Catalog=Pubs"

db.Open cnString

db.Execute "INSERT titleauthor VALUES('998-72-3567','PC8888',1,10)"

db.close
set db = nothing







--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Spud_Monkey" <spudmonkey (AT) aol (DOT) co> wrote

Quote:
Hi

Could anyone please show me some sample code on how to insert a record
into
a table via vbscript in an activex module.

Cheers





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.