473,325 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

DataLinks & MSDASC Help

Hi,

I was wondering if someone can help me - I need to provide the user with the
DataLinks dialog box and then use the connection string that is generated
from it. I've tried, but can't figure it out. I was hoping someone could
provide me a C# example? Thanks in advance.

Doug
Nov 16 '05 #1
2 6967
Doug,

First, set two references in your project (under COM):

Microsoft OLE DB Service Component 1.0 Type Library
Microsoft ActiveX Data Objects 2.7 Library

The ADO reference can be to any version that you wish.

Once you do that, the following code will prompt for a new connection:
// The data links component.
MSDASC.DataLinks pobjDataLinks = null;

// A connection class instance.
ADODB._Connection pobjConnection = null;

// Create the data links component. Wrap in
// a try/finally block to release when done.
try
{
// Create the data links instance.
pobjDataLinks = new MSDASC.DataLinksClass();

// Set the window handle.
// This assumes you are doing this in a control, and have a parent
window handle to use.
pobjDataLinks.hWnd = (int) this.Handle;

// Get the new connection.
pobjConnection = (ADODB._Connection) pobjDataLinks.PromptNew();

// From here, you can get the ConnectionString property and do what you
will with it.
}
finally
{
// Release the data links class if it is not null.
if (pobjDataLinks != null)
// Release.
Marshal.ReleaseComObject(pobjDataLinks);

// Release the connection if it exists.
if (pobjConnection != null)
// Release.
Marshal.ReleaseComObject(pobjConnection);
}

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Doug" <dk*******@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,

I was wondering if someone can help me - I need to provide the user with the DataLinks dialog box and then use the connection string that is generated
from it. I've tried, but can't figure it out. I was hoping someone could
provide me a C# example? Thanks in advance.

Doug

Nov 16 '05 #2
Nicholas,

Thank you for getting back to me so quickly - I'll give it a try.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uP**************@TK2MSFTNGP11.phx.gbl...
Doug,

First, set two references in your project (under COM):

Microsoft OLE DB Service Component 1.0 Type Library
Microsoft ActiveX Data Objects 2.7 Library

The ADO reference can be to any version that you wish.

Once you do that, the following code will prompt for a new connection:
// The data links component.
MSDASC.DataLinks pobjDataLinks = null;

// A connection class instance.
ADODB._Connection pobjConnection = null;

// Create the data links component. Wrap in
// a try/finally block to release when done.
try
{
// Create the data links instance.
pobjDataLinks = new MSDASC.DataLinksClass();

// Set the window handle.
// This assumes you are doing this in a control, and have a parent
window handle to use.
pobjDataLinks.hWnd = (int) this.Handle;

// Get the new connection.
pobjConnection = (ADODB._Connection) pobjDataLinks.PromptNew();

// From here, you can get the ConnectionString property and do what you
will with it.
}
finally
{
// Release the data links class if it is not null.
if (pobjDataLinks != null)
// Release.
Marshal.ReleaseComObject(pobjDataLinks);

// Release the connection if it exists.
if (pobjConnection != null)
// Release.
Marshal.ReleaseComObject(pobjConnection);
}

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Doug" <dk*******@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,

I was wondering if someone can help me - I need to provide the user with

the
DataLinks dialog box and then use the connection string that is generated
from it. I've tried, but can't figure it out. I was hoping someone
could
provide me a C# example? Thanks in advance.

Doug


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Sammy | last post by:
Hi, my mind is going crazy. I have tried everything I can think of to no avail. I have tried Disable Output Escaping. I tried to think of a way of enclosing the attribute data in a CDATA...
0
by: Burton Wilkins | last post by:
Gentleman: I'm trying to get the DataLink to work under C++, and I need help. I'm able to make it work under VB and C#, but not C++. Under C# (with references to "adodb", and "MSDASC") , I would...
0
by: cui_y_x2002 | last post by:
------------------------------------in VB------------------------------------------------------------------ Dim oDataLink As Object 'MSDASC.DataLinks Dim oCon As Object ...
8
by: Nathan Sokalski | last post by:
I add a JavaScript event handler to some of my Webcontrols using the Attributes.Add() method as follows: Dim jscode as String = "return (event.keyCode>=65&&event.keyCode<=90);"...
11
by: Jeremy | last post by:
How can one stop a browser from converting &amp; to & ? We have a textarea in our system wehre a user can type in some html code and have it saved to the database. When the data is retireved...
0
by: harinathreddy | last post by:
Hi all, when i tried to open a solution in VS.Net 2003, i am getting following error. The webserver reported the following error when attempting to create or open the web project located at...
3
by: gg | last post by:
I specify the Url element as <xsd:element name="Url"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="512"/> <xsd:pattern value="http://+"/> </xsd:restriction>...
0
by: Tina | last post by:
I've gotten this before where it says there is a problem with Interop.MSDASC but I can't remember what causes this. This is a 1.1 app I'm trying to debug in vs2005. It was running yesterday just...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.