Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

DataLink Dialog from ASP

0.00/5 (No votes)
24 Jan 2006 1  
An ActiveX control that allows ASP users to display datalink dialogs.

Sample Image

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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here