Senin, 15 Oktober 2012

Cara VB.NET Koneksi ke Database SQL

Waduhhh.. sudah lama tidak share knowledge, dikarenakan sibuk dengan pekerjaan. disela-sela waktu ini saya sempatkan untuk share. Untuk share kali ini adalah tentang koneksi ke database. Saya akan memberikan contoh koneksi ke berbagai jenis software penyimpan data. Baik kita mulai saja... sharingnya.

A. Koneksi ke SQL

  •     SQL ODBC connection strings
               Standard Security: 
                       "Driver={SQLServer};Server=Your_Server_Name;Database=Your_Database_Name;
                    Uid=Your_Username;Pwd=Your_Password;"

          Trusted connection:
               "Driver={SQLServer};Server=Your_Server_Name;Database=Your_Database_Name;
                Trusted_Connection=yes;"
  •  SQL OLE DB connection strings
             Standard Security:
                   "Provider=SQLOLEDB;Data Source=Your_Server_Name;
                     Initial Catalog=Your_Database_Name;UserId=Your_Username;
                     Password=Your_Password;"

            Trusted connection:
                     "Provider=SQLOLEDB;Data Source=Your_Server_Name;
                      Initial Catalog=Your_Database_Name;Integrated Security=SSPI;"

  • SQL OleDbConnection .NET strings
          Standard Security:
                 "Provider=SQLOLEDB;Data Source=Your_Server_Name;
                  Initial Catalog= Your_Database_Name;UserId=Your_Username;
                  Password=Your_Password;"

          Trusted connection:
                      "Provider=SQLOLEDB;Data Source=Your_Server_Name;
                   Initial Catalog=Your_Database_Name;Integrated Security=SSPI;"
  • SQL SqlConnection .NET strings
               Standard Security:
             1. "Data Source=Your_Server_Name;
                  Initial Catalog= Your_Database_Name;UserId=Your_Username;
                  Password=Your_Password;" 
             2. "Server=Your_Server_Name;Database=Your_Database_Name;
                  UserID=Your_Username;Password=Your_Password;Trusted_Connection=False"

          Trusted connection:
             1. "Data Source=Your_Server_Name;Initial Catalog=Your_Database_Name;
                  Integrated Security=SSPI;"
             2."Server=Your_Server_Name;Database=Your_Database_Name;
                  Trusted_Connection=True;"

Tidak ada komentar:

Posting Komentar