Oledb and SQL Clients
OLEDB Client/ SQL Client
Namespace
System.Data.OleDb/ System.Data.SqlClient
ConnectionString
Provider=SQLOLEDB.1;Persist Security Info=False;User ID={user};Password={password};Initial Catalog={Database};Data Source={host name/IP};
Server={host name/IP}; Database={dbname}; User ID={user}; Password={sqlServerPassword};
For various connection strings, have a look at connectionstrings
Getting Table list from database
DataTable dtObj = {connection}.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new Object() {null, null, null, "Table"});
DataTable dtObj = {connection}.GetSchema("Tables");
Getting Views List
DataTable dtObj = {connection}.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new Object() {null, null, null, "View"});
DataTable dtObj = {connection}.GetSchema("Views");
Getting Stored procedures List
DataTable dtObj = {connection}.GetOleDbSchemaTable(OleDbSchemaGuid.Procedures, new Object() {null, null, null, "Views"});
DataTable dtObj = {connection}.GetSchema("Procedures");
Getting Primary keys defined in the tables
OleDbSchemaGuid.PrimaryKeys
DataTable dtObj = {connection}.GetSchema("Indexes");
Bulk insert
OledbAdapter.Update(DataTable)
SqlBulkCopy
Comments
Post a Comment