![]() In my case I just want to take all ( *) data from TestTable table. Having opened database connection You need to ask for data, I mean to build SQL query. If there was no error check the state of database You connected. ![]() " database=" & database_name & " Integrated Security=SSPI " ConnectionString = "Provider=SQLNCLI11 Server=" & server_name & _ " database=" & database_name & " Integrated Security=SSPI " Open connection & state checkĪfter completing the connection string, You can also set other properties like timeout. This is something I was fighting with and looking for hours to connect.ConnectionString = "Provider=SQLNCLI11 Server=" & server_name & _ In case of MS SQL use SQLOLEDB.1 as provider, but if You got your database locally, as I have, go with SQLNCLI11. " database=" & database_name & " Integrated Security=SSPI " Solution to connect local database ![]() So putting all together it can look like this.ConnectionString = "Provider=SQLOLEDB.1 Server=" & server_name & _ You can choose from the values: true, false, yes, no and sspi. The authentication method depends on that if You pass the credentials in the connection string or use windows authentication and on provider. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |