Print Page | Close Window

SQLbulkcopy needs connection string

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
Printed Date: 22-May-2022 at 7:27pm

Topic: SQLbulkcopy needs connection string
Posted By: BigA25
Subject: SQLbulkcopy needs connection string
Date Posted: 19-Aug-2013 at 10:14am
For performance reasons I am trying to use sqlbulkcopy to insert a bunch of data into the sqlserver. 

I have been trying to use


to get the connection string but I seem to be having trouble due to it not being in the correct form.

Also the Data Source off that connection doesn't seem to be correct. 

How can i get a sql connection string from ideablade?

Posted By: kimj
Date Posted: 19-Aug-2013 at 10:56am
What you're doing will return the connection string used by DevForce for this key, so I don't know why it would be incorrect.  If you have multiple RdbKeys make sure you're looking at the correct key.  
If this is an n-tier application be sure you retrieve the RdbKeys on the server, since you likely (and shouldn't) have the connection strings on the client.
Also, if you're using a DataSourceKeyResolver this won't return the resolved connection string for the key, but something like this will:
var key = pm.DataSourceResolver.GetDataSourceKey(name) as RdbKey;
var cnstring = key.ConnectionString;

Posted By: BigA25
Date Posted: 19-Aug-2013 at 12:26pm
Your solution using the datasourekeyresolver worked perfectly. Thank you so much :-)

Print Page | Close Window