MSDASC.DataLinks PromptNew()
-
Hi, How do I create the IDataSourceLocator (hWnd) for my MSDASC.DataLinks object without first calling the PromptNew() method plus DialogResult.OK ?? I have a program where I want the user to be able to edit a connection string known (loaded) when the program starts. I want to be able to do something like this: private ADODB._Connection m_AdoDbConn; // then, create m_AdoDbConn without calling PromptNew() so I can do.. m_AdoDbConn.ConnectionString = sConnStrLoadedFromDisk; object o = (object) m_AdoDbConn; MSDASC.DataLinks oDlg = new MSDASC.DataLinksClass(); oDlg.PromptEdit(ref o); --------------- TIA, Matt
-
Hi, How do I create the IDataSourceLocator (hWnd) for my MSDASC.DataLinks object without first calling the PromptNew() method plus DialogResult.OK ?? I have a program where I want the user to be able to edit a connection string known (loaded) when the program starts. I want to be able to do something like this: private ADODB._Connection m_AdoDbConn; // then, create m_AdoDbConn without calling PromptNew() so I can do.. m_AdoDbConn.ConnectionString = sConnStrLoadedFromDisk; object o = (object) m_AdoDbConn; MSDASC.DataLinks oDlg = new MSDASC.DataLinksClass(); oDlg.PromptEdit(ref o); --------------- TIA, Matt
All you need is a valid connection string. I created an RCW from the MSDASC typelib and imported the PIA for ADODB (ADODB.dll). My sample code below worked fine (except that I changed the computer name in the
ConnectionString
):using System;
using ADODB;
using MSDASC;public class EditDSN
{
static void Main()
{
ConnectionClass conn = new ConnectionClass();
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;"
+ "Data Source=MACHINE;Initial Catalog=master";object o = conn; DataLinksClass links = new DataLinksClass(); links.PromptEdit(ref o);
}
}Microsoft MVP, Visual C# My Articles
-
All you need is a valid connection string. I created an RCW from the MSDASC typelib and imported the PIA for ADODB (ADODB.dll). My sample code below worked fine (except that I changed the computer name in the
ConnectionString
):using System;
using ADODB;
using MSDASC;public class EditDSN
{
static void Main()
{
ConnectionClass conn = new ConnectionClass();
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;"
+ "Data Source=MACHINE;Initial Catalog=master";object o = conn; DataLinksClass links = new DataLinksClass(); links.PromptEdit(ref o);
}
}Microsoft MVP, Visual C# My Articles
Heath, You are the man! Thank You.