Hello All
I'm a new in SQL and in vba here is my code snippet , can someone explain me how emboldened part works? Why does it needs those to parameters (sql, con)
Thanks in advance
Dim da As OleDb.OleDbDataAdapter Dim sql As String = Nothing dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" TheDatabase = "/AddressBook.mdb" MyDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) FullDatabasePath = MyDocumentsFolder & TheDatabase dbSource = "Data Source = " & FullDatabasePath con.ConnectionString = dbProvider & dbSource con.Open() MessageBox.Show("Database is now open") sql = "SELECT * FROM tblContacts" da = New OleDb.OleDbDataAdapter(sql, con) da.Fill(ds, "AdressBook") con.Close() MessageBox.Show("Database is now Closed") txtFirsName.Text = ds.Tables("AdressBook").Rows(0).Item(1) txtSureName.Text = ds.Tables("AdressBook").Rows(0).Item(2)




Reply With Quote