how to use connectioncreator

S

Saper\(ek\)

when You create a ne sqlconnection, or any other connection, You can use
connection creator to create a connection string. how to do this in Your own
components?

--


"Zeglarstwo jest koniecznoscia
zycie nia nie jest"

www.saper.infra.pl/

Saper(ek)
 
N

Nicholas Paldino [.NET/C# MVP]

Saper,

The connection creator that you are using is only good for OLE-DB
connections. If you want to use a connection for SQL server, then you could
make sure that the provider is the one for SQL server and then strip off the
provider part, and the rest you should be able to pass to the SqlConnection
constructor.

To use the dialog, you will have to use the IDbPromptInitialize COM
interface with OLE db. The section of the OLE DB Programmer's Reference
titled "Creating Data Source Objects" located at (watch for line wrap):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/oledb/htm/olprchapter02_2.asp

Should help. You will have to use COM interop, but the interfaces you
need to use and how to use them are defined there.

Hope this helps.
 
S

Saper\(ek\)

hm... no I don't think this is what I was looking for... when You add an
SQLConnection from toolbox to Your project (or OleDbConnection, or any other
connection), and select it, You can set objects properties in designer, in
object inspector. Property named ConnectionString, You can input manualy or
click on the 3 dots button to open a connectionstring creator. how to use
this connectionstring creator in my own components?

--


"Zeglarstwo jest koniecznoscia
zycie nia nie jest"

www.saper.infra.pl/

Saper(ek)
U¿ytkownik "Nicholas Paldino [.NET/C# MVP]"
Saper,

The connection creator that you are using is only good for OLE-DB
connections. If you want to use a connection for SQL server, then you could
make sure that the provider is the one for SQL server and then strip off the
provider part, and the rest you should be able to pass to the SqlConnection
constructor.

To use the dialog, you will have to use the IDbPromptInitialize COM
interface with OLE db. The section of the OLE DB Programmer's Reference
titled "Creating Data Source Objects" located at (watch for line wrap):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/oledb/htm/olprchapter02_2.asp

Should help. You will have to use COM interop, but the interfaces you
need to use and how to use them are defined there.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Saper(ek) said:
when You create a ne sqlconnection, or any other connection, You can use
connection creator to create a connection string. how to do this in Your own
components?

--


"Zeglarstwo jest koniecznoscia
zycie nia nie jest"

www.saper.infra.pl/

Saper(ek)
 
N

Nicholas Paldino [.NET/C# MVP]

Actually, it is. The dialog that is opened is provided by OLE-DB, not
by VS.NET or by .NET itself. The property grid is just an instance of the
PropertyGrid class (which you can add to your toolbox).

The article that I showed you will bring up the same dialog.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Saper(ek) said:
hm... no I don't think this is what I was looking for... when You add an
SQLConnection from toolbox to Your project (or OleDbConnection, or any other
connection), and select it, You can set objects properties in designer, in
object inspector. Property named ConnectionString, You can input manualy or
click on the 3 dots button to open a connectionstring creator. how to use
this connectionstring creator in my own components?

--


"Zeglarstwo jest koniecznoscia
zycie nia nie jest"

www.saper.infra.pl/

Saper(ek)
U¿ytkownik "Nicholas Paldino [.NET/C# MVP]"
Saper,

The connection creator that you are using is only good for OLE-DB
connections. If you want to use a connection for SQL server, then you could
make sure that the provider is the one for SQL server and then strip off the
provider part, and the rest you should be able to pass to the SqlConnection
constructor.

To use the dialog, you will have to use the IDbPromptInitialize COM
interface with OLE db. The section of the OLE DB Programmer's Reference
titled "Creating Data Source Objects" located at (watch for line wrap):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/oledb/htm/olprchapter02_2.asp
Should help. You will have to use COM interop, but the interfaces you
need to use and how to use them are defined there.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Saper(ek) said:
when You create a ne sqlconnection, or any other connection, You can use
connection creator to create a connection string. how to do this in
Your
own
components?

--


"Zeglarstwo jest koniecznoscia
zycie nia nie jest"

www.saper.infra.pl/

Saper(ek)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top