SHARE
TWEET

Load Data Ke GridControl

stevennathaniel Feb 22nd, 2018 (edited) 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports DevExpress.Xpo
  2.  
  3. Imports DevExpress.Xpo.DB
  4.  
  5. Imports DevExpress.DataAccess.Sql
  6.  
  7. Imports DevExpress.DataAccess.ConnectionParameters
  8.  
  9. Imports System
  10.  
  11. Imports System.Collections
  12.  
  13.  
  14.  
  15.  
  16. Public Class Form1
  17.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  18.  
  19.         'Dim koneksi As String = DevExpress.Xpo.DB.MySqlConnectionProvider.GetConnectionString("localhost", "root", "", "latihan")
  20.  
  21.         'XpoDefault.DataLayer = XpoDefault.GetDataLayer(koneksi, AutoCreateOption.DatabaseAndSchema)
  22.  
  23.         'Dim laporan1 As New XtraReport1
  24.  
  25.         'Dim datalayer As IDataLayer = XpoDefault.GetDataLayer(koneksi, AutoCreateOption.DatabaseAndSchema)
  26.  
  27.         'XpoDefault.DataLayer = datalayer
  28.  
  29.         Dim mysqlParams As New MySqlConnectionParameters
  30.  
  31.         mysqlParams.ServerName = "localhost"
  32.  
  33.         mysqlParams.DatabaseName = "latihan"
  34.  
  35.         mysqlParams.UserName = "rahasia"
  36.  
  37.         mysqlParams.Password = "rahasia"
  38.  
  39.  
  40.         Dim ds As New SqlDataSource(mysqlParams)
  41.  
  42.         Dim query As New CustomSqlQuery
  43.  
  44.         query.Name = "customQuery"
  45.  
  46.         query.Sql = "SELECT * FROM tabel1"
  47.  
  48.  
  49.         ds.Queries.Add(query)
  50.  
  51.  
  52.         ds.RebuildResultSchema()
  53.  
  54.         ds.Fill()
  55.  
  56.         GridControl1.DataSource = ds
  57.  
  58.         GridControl1.DataMember = "customQuery"
  59.  
  60.  
  61.     End Sub
  62. End Class
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top