Guest User

Untitled

a guest
May 23rd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. Try
  2.  
  3. conexion.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source = C:\temp\Nwind2.MDB"
  4. conexion.Open()
  5. Dim line As String = "select distinct p.ProductName,s.CompanyName,c.CategoryName,o.UnitPrice from Products p,Suppliers s,Categories c,OrderDetails o where " _
  6. & " and p.SupplierID=s.SupplierID and p.CategoryID=c.CategoryID and p.ProductID=o.ProductID "
  7. Dim comando As New OleDbCommand
  8. comando.CommandType = CommandType.Text
  9. comando.CommandText = line
  10. Dim sr As OleDbDataReader = comando.ExecuteReader
  11. Me.SaveFileDialog1.InitialDirectory = "C:"
  12. Me.SaveFileDialog1.Filter = "Text Files (*.txt)|*.txt"
  13. Me.SaveFileDialog1.ShowDialog()
  14. Dim sw As New IO.StreamWriter(Me.SaveFileDialog1.FileName)
  15. While sr.Read()
  16. sw.WriteLine(sr.Item("ProductName") & "#" & sr.Item("UnitPrice"))
  17. End While
  18.  
  19. sw.Close()
  20. Catch ex As Exception
  21.  
  22. End Try
Add Comment
Please, Sign In to add comment