Kết nốidữliệutừSQL2005 sang VisualBasic2005 Nguồn : forum.t3h.vn Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim conn As New OleDb.OleDbConnection("Provider=SQLNCLI;Server=.\SQLEXP RESS;Database=TênData; Uid=sa; Pwd=MậtKhau;") conn.Open() Dim cmd As New OleDb.OleDbCommand("CREATE TABLE persons ( " & _ "AutoId int identity ," & _ "Id int NOT NULL," & _ "Name NVarchar(50)," & _ "BirthDate datetime," & _ "IdCountry int," & _ "CONSTRAINT [pk_AutoId] PRIMARY KEY (AutoId)) ", conn) Try cmd.ExecuteNonQuery() Catch ex As OleDb.OleDbException MessageBox.Show(ex.Message, "OleDbException") Catch ex As Exception MessageBox.Show(ex.Message, "GeneralException") End Try conn.Close() End Sub . Kết nối dữ liệu từ SQL 2005 sang Visual Basic 2005 Nguồn : forum.t3h.vn Private Sub Button1_Click(ByVal. Button1.Click Dim conn As New OleDb.OleDbConnection("Provider=SQLNCLI;Server=.SQLEXP RESS;Database=TênData; Uid=sa; Pwd=MậtKhau;") conn.Open()