Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Wednesday, June 18, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Create Tables into external SQL data Base
Ramses
Posts: 6
 
Create Tables into external SQL data BaseYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Mar 07 2:42 PM
fiogf49gjkf0d
Hi I need to create a tables from SLX Application to another SQL Database, can I do it from SLX?, can I create Tables into SQL External Database?
I.E: I'am in SLX_DB1 from SLX aplication and I need to create 2 tables to a external SQL DB because I wont Use SQL Query Analyzer because is part of my application can somebody Help me?

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CT_CamisaConnect]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CT_CamisaConnect]
GO

CREATE TABLE [dbo].[CT_CamisaConnect] (
[TableName] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[UniqueID] [int] NOT NULL ,
[EntityID] [varchar] (12) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ModifyDate] [datetime] NULL ,
[ModifyUser] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[LinkFlag] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[DeleteFlag] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
[Reply][Quote]
Jeff Weight
Posts: 219
 
Re: Create Tables into external SQL data BaseYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Mar 07 9:41 AM
fiogf49gjkf0d
Yes, I believe it is possible. To do things like this, where you need to bypass the provider, you just create a connection that goes straight to the database with your VBScript. Here is an example of how I do this:

Function GetDirectConnection()
Dim strConn, theDirectConnection
Set gdcRS = Application.GetNewConnection.Execute("slx_getNativeConnInfo()")
strConn = "Provider=SQLOLEDB.1assword=(MyPassword)ersist Security Info=True;" & _
"User ID=(DBUserName);Initial Catalog=(DatabaseName);Data Source=(YourServerName)"
Set theDirectConnection = CreateObject("ADODB.Connection")
theDirectConnection.Open strConn
Set GetDirectConnection = theDirectConnection
End Function

So, everytime I want to bypass the provider, I call this function - instead of "Set objCon = Application.GetNewConnection", I use "Set objCon = GetDirectConnection"

Only one issues with this method that I can think of: Where this script is saved, a username and password to SQL Server is stored, and that user will have table creation rights. If you don't want your SalesLogix Developer (if there is a separate developer) to see this login info, then this method will not work for you.

Hope this does it for you...
[Reply][Quote]
Jeff Weight
Posts: 219
 
Re: Create Tables into external SQL data BaseYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Mar 07 9:44 AM
fiogf49gjkf0d
Ok, everyone, that was my very first post ever, so I did not realize that certain characters would translate to active smileys... wherever you see a smiley with a tongue, translate that to a ";" character followed by a "P" character. I didn't mean to stick my tongue at you Ramses!
[Reply][Quote]
Ramses
Posts: 6
 
Re: Create Tables into external SQL data BaseYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Mar 07 10:37 AM
fiogf49gjkf0d
Oks thanks for your example is very good but I'am new on this I don't have idea how to do it I mean then how can I create the Tables? I create GetDirectConnection Function and works but what is the next step and how can I do it
[Reply][Quote]
Jeff Weight
Posts: 219
 
Re: Create Tables into external SQL data BaseYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Mar 07 11:30 AM
fiogf49gjkf0d
Woohoo! I'm glad I could partially help you. As for creating the table, it looked like you had the right script in your first post. So, the complete script you would need is

Dim objCon, strSQL
Set objCon = GetDirectConnection
strSQL = "IF EXISTS(select * from dbo.sysobjects where id = object_id(N'[dbo].[CT_CamisaConnect]') and " & _
"OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[CT_CamisaConnect]"
objCon.Execute(strSQL)
strSQL = "CREATE TABLE [dbo].[CT_CamisaConnect] (" & _
"[TableName] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,(" & _
"[UniqueID] [int] NOT NULL , " & _
"[EntityID] [varchar] (12) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ," & _
"[ModifyDate] [datetime] NULL ," & _
"[ModifyUser] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ," & _
"[LinkFlag] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, " & _
"[DeleteFlag] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL) ON [PRIMARY] "
objCon.Execute(strSQL)
objCon.Close
Set objCon = Nothing

Now, I have never tested the script you posted, but if it is correct, that'll do the trick.
[Reply][Quote]
Ramses
Posts: 6
 
Re: Create Tables into external SQL data BaseYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Mar 07 12:03 PM
fiogf49gjkf0d
thanks for your help very functional
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 6/18/2025 2:44:58 AM