PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
invoke ado connection wizard at runtime C#
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
invoke ado connection wizard at runtime C#
![]() |
invoke ado connection wizard at runtime C# |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Is it possible to invoke this wizard at runtime, using c#, if so how?
|
|
|
|
#2 |
|
Guest
Posts: n/a
|
You need to add references to both of these COM libraries:
Microsoft ActiveX Data Objects 2.8 Library Microsoft OLEDB Service Component 1.0 Type Library If you want to generate a new connectionstring: public string NewConnectionString() { object _con = null; MSDASC.DataLinks _link = new MSDASC.DataLinks(); _con = _link.PromptNew(); if (_con == null) return string.Empty; return ((ADODB.Connection)_con).ConnectionString; } If you want to modify an existing connectionstring: public void ExistingConnection(ref string connectionstring) { MSDASC.DataLinks _link = new MSDASC.DataLinks(); ADODB.Connection _con = new ADODB.Connection(); _con.ConnectionString = connectionstring; if (_link.PromptEdit((object)_con)) { connectionstring = _con.ConnectionString; } } "Jack Wasserstein" <JackWasserstein@discussions.microsoft.com> wrote in message news:EB354E06-4073-4185-A65C-3EA56104311D@microsoft.com... > Is it possible to invoke this wizard at runtime, using c#, if so how? |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Thanks Stephany,
but i dont see any of the .net data providers in the data link dialog box that pops up? "Stephany Young" wrote: > You need to add references to both of these COM libraries: > > Microsoft ActiveX Data Objects 2.8 Library > Microsoft OLEDB Service Component 1.0 Type Library > > If you want to generate a new connectionstring: > > public string NewConnectionString() > { > object _con = null; > MSDASC.DataLinks _link = new MSDASC.DataLinks(); > _con = _link.PromptNew(); > if (_con == null) return string.Empty; > return ((ADODB.Connection)_con).ConnectionString; > } > > If you want to modify an existing connectionstring: > > public void ExistingConnection(ref string connectionstring) > { > MSDASC.DataLinks _link = new MSDASC.DataLinks(); > ADODB.Connection _con = new ADODB.Connection(); > _con.ConnectionString = connectionstring; > if (_link.PromptEdit((object)_con)) > { > connectionstring = _con.ConnectionString; > } > } > > > "Jack Wasserstein" <JackWasserstein@discussions.microsoft.com> wrote in > message news:EB354E06-4073-4185-A65C-3EA56104311D@microsoft.com... > > Is it possible to invoke this wizard at runtime, using c#, if so how? > > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Ummmmmm ... That would be correct. Why would you expect to?
"Jack Wasserstein" <JackWasserstein@discussions.microsoft.com> wrote in message news:48D66AA9-EB32-4A10-9ABF-BB44A44DE2CB@microsoft.com... > Thanks Stephany, > > but i dont see any of the .net data providers in the data link dialog box > that pops up? > > "Stephany Young" wrote: > >> You need to add references to both of these COM libraries: >> >> Microsoft ActiveX Data Objects 2.8 Library >> Microsoft OLEDB Service Component 1.0 Type Library >> >> If you want to generate a new connectionstring: >> >> public string NewConnectionString() >> { >> object _con = null; >> MSDASC.DataLinks _link = new MSDASC.DataLinks(); >> _con = _link.PromptNew(); >> if (_con == null) return string.Empty; >> return ((ADODB.Connection)_con).ConnectionString; >> } >> >> If you want to modify an existing connectionstring: >> >> public void ExistingConnection(ref string connectionstring) >> { >> MSDASC.DataLinks _link = new MSDASC.DataLinks(); >> ADODB.Connection _con = new ADODB.Connection(); >> _con.ConnectionString = connectionstring; >> if (_link.PromptEdit((object)_con)) >> { >> connectionstring = _con.ConnectionString; >> } >> } >> >> >> "Jack Wasserstein" <JackWasserstein@discussions.microsoft.com> wrote in >> message news:EB354E06-4073-4185-A65C-3EA56104311D@microsoft.com... >> > Is it possible to invoke this wizard at runtime, using c#, if so how? >> >> >> |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Perhaps I posted my question incorrectly, but i am looking to create a
connection string to a sql 2005 express database using the wizard at runtime. Do you know how to call that one? "Stephany Young" wrote: > Ummmmmm ... That would be correct. Why would you expect to? > > > "Jack Wasserstein" <JackWasserstein@discussions.microsoft.com> wrote in > message news:48D66AA9-EB32-4A10-9ABF-BB44A44DE2CB@microsoft.com... > > Thanks Stephany, > > > > but i dont see any of the .net data providers in the data link dialog box > > that pops up? > > > > "Stephany Young" wrote: > > > >> You need to add references to both of these COM libraries: > >> > >> Microsoft ActiveX Data Objects 2.8 Library > >> Microsoft OLEDB Service Component 1.0 Type Library > >> > >> If you want to generate a new connectionstring: > >> > >> public string NewConnectionString() > >> { > >> object _con = null; > >> MSDASC.DataLinks _link = new MSDASC.DataLinks(); > >> _con = _link.PromptNew(); > >> if (_con == null) return string.Empty; > >> return ((ADODB.Connection)_con).ConnectionString; > >> } > >> > >> If you want to modify an existing connectionstring: > >> > >> public void ExistingConnection(ref string connectionstring) > >> { > >> MSDASC.DataLinks _link = new MSDASC.DataLinks(); > >> ADODB.Connection _con = new ADODB.Connection(); > >> _con.ConnectionString = connectionstring; > >> if (_link.PromptEdit((object)_con)) > >> { > >> connectionstring = _con.ConnectionString; > >> } > >> } > >> > >> > >> "Jack Wasserstein" <JackWasserstein@discussions.microsoft.com> wrote in > >> message news:EB354E06-4073-4185-A65C-3EA56104311D@microsoft.com... > >> > Is it possible to invoke this wizard at runtime, using c#, if so how? > >> > >> > >> > > > |
|
|
|
#6 |
|
Guest
Posts: n/a
|
Stumbled across this by accident while I was looking for something else:
Step 1: Add references to: Microsoft.Data.ConnectionUI.dll Microsoft.Data.ConnectionUI.Dialog.dll You will need to browse for them at C:\Program Files\Microsoft Visual Studio 8\Common7\IDE (assuming that your VS2005 is installed to the default location) Step 2: Wherever you want to use it, execute: Microsoft.Data.ConnectionUI.Dialog.DataConnectionDialog _dialog = new Microsoft.Data.ConnectionUI.Dialog.DataConnectionDialog(); Microsoft.Data.ConnectionUI.Dialog.DataSource.AddStandardDataSources(_dialog); Microsoft.Data.ConnectionUI.Dialog.DataConnectionDialog.Show(_dialog); You will need to have a play with it to find out how to use it because I have no further information than that. "Jack Wasserstein" <JackWasserstein@discussions.microsoft.com> wrote in message news:3864EA6E-8A50-408D-98F0-7270683E0D73@microsoft.com... > Perhaps I posted my question incorrectly, but i am looking to create a > connection string to a sql 2005 express database using the wizard at > runtime. > Do you know how to call that one? > > "Stephany Young" wrote: > >> Ummmmmm ... That would be correct. Why would you expect to? >> >> >> "Jack Wasserstein" <JackWasserstein@discussions.microsoft.com> wrote in >> message news:48D66AA9-EB32-4A10-9ABF-BB44A44DE2CB@microsoft.com... >> > Thanks Stephany, >> > >> > but i dont see any of the .net data providers in the data link dialog >> > box >> > that pops up? >> > >> > "Stephany Young" wrote: >> > >> >> You need to add references to both of these COM libraries: >> >> >> >> Microsoft ActiveX Data Objects 2.8 Library >> >> Microsoft OLEDB Service Component 1.0 Type Library >> >> >> >> If you want to generate a new connectionstring: >> >> >> >> public string NewConnectionString() >> >> { >> >> object _con = null; >> >> MSDASC.DataLinks _link = new MSDASC.DataLinks(); >> >> _con = _link.PromptNew(); >> >> if (_con == null) return string.Empty; >> >> return ((ADODB.Connection)_con).ConnectionString; >> >> } >> >> >> >> If you want to modify an existing connectionstring: >> >> >> >> public void ExistingConnection(ref string connectionstring) >> >> { >> >> MSDASC.DataLinks _link = new MSDASC.DataLinks(); >> >> ADODB.Connection _con = new ADODB.Connection(); >> >> _con.ConnectionString = connectionstring; >> >> if (_link.PromptEdit((object)_con)) >> >> { >> >> connectionstring = _con.ConnectionString; >> >> } >> >> } >> >> >> >> >> >> "Jack Wasserstein" <JackWasserstein@discussions.microsoft.com> wrote >> >> in >> >> message news:EB354E06-4073-4185-A65C-3EA56104311D@microsoft.com... >> >> > Is it possible to invoke this wizard at runtime, using c#, if so >> >> > how? >> >> >> >> >> >> >> >> >> |
|
|
|
#7 |
|
Guest
Posts: n/a
|
At the time, all I was posting was some information that I stumbled across.
Having now tried it, I find that: A reference to Microsoft.Data.ConnectionUI.dll is not necessary - only a reference to Microsoft.Data.ConnectionUI.Dialog.dll is required. The namespace in Microsoft.Data.ConnectionUI.Dialog.dll is actually Microsoft.Data.ConnectionUI rather than Microsoft.Data.ConnectionUI.Dialog so amend the 3 lines of code accordingly. Microsoft.Data.ConnectionUI.DataConnectionDialog _dialog = new Microsoft.Data.ConnectionUI.DataConnectionDialog(); Microsoft.Data.ConnectionUI.DataSource.AddStandardDataSources(_dialog); Microsoft.Data.ConnectionUI.DataConnectionDialog.Show(_dialog); I found that by simply opening the object browser in the IDE and having a look at the namespaces exposed by the Microsoft.Data.ConnectionUI.Dialog reference. I have no need to use this dialog (as yet) and therfore have no need or inclination to research this further, so you on your own from here. "Jack Wasserstein" <JackWasserstein@discussions.microsoft.com> wrote in message news:E5B2145A-F604-47E9-A613-9D12728394A4@microsoft.com... > Hi Stephany, > > Even though I added the Microsoft.Data.ConnectionUI.Dialog.dll as a > reference i am getting this error message when I try to Run the app. I > did > add both of the references. Is there another one that the Dialog one > depends > on that i am missing? > > Error 1 The type or namespace name 'Dialog' does not exist in the > namespace > 'Microsoft.Data.ConnectionUI' (are you missing an assembly > reference?) C:\Program > Files\Invoicible\BillingJWV2\ADOConnection.cs 9 35 Invocible > > > "Stephany Young" wrote: > >> Stumbled across this by accident while I was looking for something else: >> >> Step 1: >> >> Add references to: >> >> Microsoft.Data.ConnectionUI.dll >> Microsoft.Data.ConnectionUI.Dialog.dll >> >> You will need to browse for them at C:\Program Files\Microsoft Visual >> Studio 8\Common7\IDE >> (assuming that your VS2005 is installed to the default location) >> >> Step 2: >> >> Wherever you want to use it, execute: >> >> Microsoft.Data.ConnectionUI.Dialog.DataConnectionDialog _dialog = new >> Microsoft.Data.ConnectionUI.Dialog.DataConnectionDialog(); >> >> >> Microsoft.Data.ConnectionUI.Dialog.DataSource.AddStandardDataSources(_dialog); >> >> >> Microsoft.Data.ConnectionUI.Dialog.DataConnectionDialog.Show(_dialog); >> >> You will need to have a play with it to find out how to use it because I >> have no further information than that. >> >> >> "Jack Wasserstein" <JackWasserstein@discussions.microsoft.com> wrote in >> message news:3864EA6E-8A50-408D-98F0-7270683E0D73@microsoft.com... >> > Perhaps I posted my question incorrectly, but i am looking to create a >> > connection string to a sql 2005 express database using the wizard at >> > runtime. >> > Do you know how to call that one? >> > >> > "Stephany Young" wrote: >> > >> >> Ummmmmm ... That would be correct. Why would you expect to? >> >> >> >> >> >> "Jack Wasserstein" <JackWasserstein@discussions.microsoft.com> wrote >> >> in >> >> message news:48D66AA9-EB32-4A10-9ABF-BB44A44DE2CB@microsoft.com... >> >> > Thanks Stephany, >> >> > >> >> > but i dont see any of the .net data providers in the data link >> >> > dialog >> >> > box >> >> > that pops up? >> >> > >> >> > "Stephany Young" wrote: >> >> > >> >> >> You need to add references to both of these COM libraries: >> >> >> >> >> >> Microsoft ActiveX Data Objects 2.8 Library >> >> >> Microsoft OLEDB Service Component 1.0 Type Library >> >> >> >> >> >> If you want to generate a new connectionstring: >> >> >> >> >> >> public string NewConnectionString() >> >> >> { >> >> >> object _con = null; >> >> >> MSDASC.DataLinks _link = new MSDASC.DataLinks(); >> >> >> _con = _link.PromptNew(); >> >> >> if (_con == null) return string.Empty; >> >> >> return ((ADODB.Connection)_con).ConnectionString; >> >> >> } >> >> >> >> >> >> If you want to modify an existing connectionstring: >> >> >> >> >> >> public void ExistingConnection(ref string connectionstring) >> >> >> { >> >> >> MSDASC.DataLinks _link = new MSDASC.DataLinks(); >> >> >> ADODB.Connection _con = new ADODB.Connection(); >> >> >> _con.ConnectionString = connectionstring; >> >> >> if (_link.PromptEdit((object)_con)) >> >> >> { >> >> >> connectionstring = _con.ConnectionString; >> >> >> } >> >> >> } >> >> >> >> >> >> >> >> >> "Jack Wasserstein" <JackWasserstein@discussions.microsoft.com> >> >> >> wrote >> >> >> in >> >> >> message news:EB354E06-4073-4185-A65C-3EA56104311D@microsoft.com... >> >> >> > Is it possible to invoke this wizard at runtime, using c#, if so >> >> >> > how? >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

