Архифлеймер
Зарегистрирован: 28 June 2006
Сообщения: 3411
Примеры кода: 0
|
Re: Вопрос про подключение к любой БД |
15 July 2008 23:27 |
|
|
|
|
может быть вот так
Dim factory As DbProviderFactory
factory = DbProviderFactories.GetFactory("System.Data.SqlClient")
Dim testConnection As Sqlconnection
testConnection = factory.CreateConnection()
testConnection.ConnectionString="строка подключения"
testConnection.Open()
Dim testCommand As SqlCommand = factory.CreateCommand()
testCommand.Connection = testConnection
testCommand.CommandText = "запрос"
Dim reader As AqlDataReader = test.Command.ExecuteReader()
Т.к.System.Data.SqlClient реализует интерфейс System.Data.IDbConnection и потомок класса System.Data.Providerbase.DbConnection
|
|