Database Connection Control .NET (MSDASC.Datalink)

AndyDale

Member
Joined
Nov 13, 2007
Messages
23
Location
Warwick, UK
Programming Experience
10+
Hi, does anybody know of a Database Connection Control for .NET.

I've been looking for an easy way to create and test database connections strings using a .NET control but I'm finding it a little difficult.

In VB6 I'd use the MSDASC.Datalink from the Microsoft OLE DB Service Component to connect to MS SQL Server or a MS Access Database.

Is there a .NET version of MSDASC.Datalink?
 
You can use the Oledb Connector Component in vb .net ....

It is located in the toolbox pallete in the Data section ...

If you cannot find it, right click on the Data section's header and click "Choose Items" ...
A dialog box then appears .. In the dialog box find:

OledbConnection
OledbDataAdapter
OledbCommand
OledbCommandBuilder

just check the checkboxes ...
 
Thanks daniel02_0403,

These OLEDB controls were hidden now all I have to do is work out how to use them:)

The part I'm really interested in is programmatically starting up the 'Data Adapter Configuration Wizard' within my application. Have you any idea on how I may do this:confused:

Then I'd like to programmatically populate some of the 'Data Adapter Configuration Wizard' items so I can test the connection.

Is this possible:confused:
 
Do you mean to programmatically do manipulations with your connection and how to retrieve data?

If that is what you want (if I'm correct) .. it can be done .. and in fact with ease to .. :)

try these codes as a guide:


Dim con as new Oledb.OledbConnection
Dim cmd as new Oledb.OledbCommand
Dim da as new Oledb.OledbDataAdapter
Dim ds as new Dataset

con.ConnectionString = " ........ (your connection string goes here) .... "
cmd.Connection = con
cmd.CommandType = CommandType.Text
cmd.CommandText = "... (your sql statement goes here) .... "
da.SelectCommand = cmd
ds.Tables.Add("myTable") 'any table name will do, myTable is just an example
ds.Tables("myTable").Clea() 'clears data in myTable

con.Open()
da.SelectCommand.ExecuteNonQuery()
da.Fill(ds.Tables("myTable"))
con.Close()


there you have it .... you can retrieve data with that code and the data retrieved are stored in the dataset ds ..

you can then use this dataset as a datasource for your grid, combobox, etc ....


:)


kindly add to my reputation if you find my posts helpful .. just a favor .. thanks :)
 
Last edited:
Thanks again,

I’d like to use a GUI such as the 'Data Adapter Configuration Wizard' and ‘Add Connection’ from within my application (at run time).

I do know how to create a connection string but I'd like to manipulate, maybe change providers and test connection using a GUI.

Is there a way of starting the 'Data Adapter Configuration Wizard' and ‘Add Connection’ from within my code at run time?
 
Unless you plan to allow users to change their connection strings at runtime (very unusual), it would be advisable not to give the users this functionality..
 
Manipulation of your connection string through a GUI at runtime can be done ....
It's not that very hard in fact ...
but as what cjard said ... it is not advisable for users to have this functionality ...

But if you really want to, then go .. there's no problem with that after all ....


all you have to do is just make a GUI with some textboxes that would contain the provider, host, database name, etc .....
and then just concatenate those values to make your connections string ...

it's just that easy :)
 
Back
Top