Community forum

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
Offline tom_v  
#1 Posted : Monday, February 19, 2018 4:35:51 PM(UTC)
tom_v

Rank: No customer

Joined: 2/19/2018(UTC)
Posts: 2
Germany
Location: Berlin, Berlin

Hello,

I have a problem with SQL Connections.
When I build a SQL Connection with all parameters, how can initalize Visual Cron to build the ConnectionString from my parameters?

Here is my Code:
Quote:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VisualCronAPI;
using VisualCron;


namespace vc1
{
class Create_Connections_SQL
{
Server server;
VCDS vcds;

public Create_Connections_SQL(VCDS vcds)
{
this.server = vcds.server;
this.vcds = vcds;
}

public VCDS create()
{
mssql(name: "test123", instanz: @"ServerXYZ,Port123", db: "test");
return vcds;
}

void mssql(String name, String instanz, String db )
{
ConnectionClass co = new ConnectionClass();
co.Name = name;
co.ProtocolType = ConnectionClass.ProtocolT.SQL;
co.SecurityMode = ConnectionClass.SecurityModeT.Implicit;

co.SQLConnection.DataBaseType = SQLConnectionClass.DatabaseT.MSSQL;
co.SQLConnection.StorageType = SQLConnectionClass.StorageT.Database;
co.SQLConnection.DataProvider = SQLConnectionClass.DataProviderT.DirectMSSQL;
co.SQLConnection.ConnectionTypeId = 34;
co.SQLConnection.WizardId = 1;

SQLConnectionParameterClass p1 = new SQLConnectionParameterClass();
p1.ParameterName = "Server";
p1.ParameterValue = server.Encrypt(instanz);
co.SQLConnection.ConnectionParameters.Add(p1);

SQLConnectionParameterClass p2 = new SQLConnectionParameterClass();
p2.ParameterName = "Database";
p2.ParameterValue = server.Encrypt(db);
co.SQLConnection.ConnectionParameters.Add(p2);

SQLConnectionParameterClass p3 = new SQLConnectionParameterClass();
p3.ParameterName = "Trusted_Connection";
p3.ParameterValue = server.Encrypt("true");
co.SQLConnection.ConnectionParameters.Add(p3);


server.Connections.Add(co );
vcds.theconns.Add(name, co);
}

}
}


Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Scroll to Top