New Posts New Posts RSS Feed: SQLbulkcopy needs connection string
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

SQLbulkcopy needs connection string

 Post Reply Post Reply
Author
BigA25 View Drop Down
Newbie
Newbie


Joined: 16-Aug-2013
Posts: 3
Post Options Post Options   Quote BigA25 Quote  Post ReplyReply Direct Link To This Post Topic: SQLbulkcopy needs connection string
    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

IdeaBladeConfig.Instance.RdbKeys[0].Connection 

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?


Edited by BigA25 - 19-Aug-2013 at 10:26am
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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;
 
Back to Top
BigA25 View Drop Down
Newbie
Newbie


Joined: 16-Aug-2013
Posts: 3
Post Options Post Options   Quote BigA25 Quote  Post ReplyReply Direct Link To This Post Posted: 19-Aug-2013 at 12:26pm
Your solution using the datasourekeyresolver worked perfectly. Thank you so much :-)
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down