Introduction
This ActiveX control allows the user to build a connection string from the data providers listed on a client machine. The ActiveX invokes the standard DataLink dialog that lists all the data providers and the parameters needed for a valid connection string. This dialog also tests the connection.
Using the code
dl
: the ActiveX object that displays the DataLink dialog.
OpenDl
: Opens the DataLink dialog.
connectin
: string returned by the DataLink dialog.
VBScript is used for calling the ActiveX control methods.
<HEAD>
<title>Test Datalink Dialog from .Net</title>
<meta content="Microsoft Visual Studio .NET 7.1"
name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<script language="vbscript">
Sub cmdChange_Click
dl.openDl
document.forms(0).txtConnectionString.Value = _
dl.connectin
End Sub
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<OBJECT id="dl" codeBase="dl.CAB#version=1,0,0,0"
height="0" width="0"
classid="CLSID:ED467200-646D-46ED-992A-418EC94C319F"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="26">
<PARAM NAME="_ExtentY" VALUE="26">
</OBJECT>
<form id="Form1" method="post" runat="server">
<asp:TextBox id="txtConnectionString"
style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 64px"
runat="server"></asp:TextBox>
<INPUT TYPE="button" id="dlName2"
NAME="dlName2" VALUE="test" OnClick="cmdChange_Click"
style="Z-INDEX: 102; LEFT: 176px; POSITION: absolute; TOP: 64px">
<asp:Label id="Label1"
style="Z-INDEX: 103; LEFT: 24px; POSITION: absolute; TOP: 32px"
runat="server" Width="344px"
Font-Size="Larger">Datalink Dialog</asp:Label>
</form>
</body>
</HTML>
Points of Interest
ActiveX is a complete new world for me. I am a hardcore .NET programmer. I used to dislike VB 6, but I have to admit, it is great for creating ActiveX controls. They provide full system access. A little risky if run over the Internet, but in specific environments (like intranets) they could be quite useful.
History
So far this is the first version, it was made for a specific client need. There are tons of improvements that can be made, however I don't have the time right now.