![]() |
Connectionstring per Dialog ermitteln
Hallo Leute,
in Programmen für Win32 habe ich beim ersten Programmstart den Benutzer den Connectionsstring mit folgendem Con erstellen lassen:
Code:
Der Dialog erlaubt die Erstellung des ConnectionString genauso wie in der IDE. Nach der Anzeige der Provider folgt die Festlegung der Userkennung usw.
newConnString = PromptDataSource(handle,'');
Ich möchte nun das Gleiche unter Nutzung des .NET Frameworks tun (so dass die Vorgehensweise auch in C# möglich wäre). Weiß jemand wie das geht? Schon im Voraus vielen Dank für Eure Hinweise. Niels |
Re: Connectionstring per Dialog ermitteln
Hallo Neugierig,
Folgende Methode lößt das Problem in C#:
Delphi-Quellcode:
using System.Data;
using System.Data.OleDb; using MSDASC; using ADODB;
Code:
Gruß, Tom
private string DataSourcePrompt(string connectionString)
{ try { Connection connection1 = null; DataLinks dataLinks1 = new DataLinksClass(); if (connectionString == string.Empty) { connection1 = (Connection) dataLinks1.PromptNew(); return connection1.ConnectionString.ToString(); } connection1 = new ConnectionClass(); connection1.ConnectionString = connectionString; object object1 = connection1; if (dataLinks1.PromptEdit(ref object1)) { connectionString = connection1.ConnectionString; } connectionString = connectionString; } catch (Exception exception1) { Debug.WriteLine(exception1.ToString()); connectionString = string.Empty; } return connectionString; } [edit=fkerber][delphi]-Tags --> [c]-Tags. Mfg, fkerber[/edit] |
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:37 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz