Axspreadsheet datasource

  • Follow


Hi all,
  I am using OWC11 (AxSpreadsheet) control in my vb.net application. In that 
i need to display data from Mysql DB. This is my sample code to bind data to 
spreadsheet.

	AxSpreadsheet2.Worksheets(1).Cells.Clear()
	AxSpreadsheet2.Worksheets(1).Name = "Batches"
	AxSpreadsheet2.Worksheets(1).StandardWidth = 15

	cmd.CommandText = "SELECT * FROM `TableName`"
        cmd.Connection = connect
        If connect.State = ConnectionState.Closed Then connect.Open()
        Dim da As New MySqlClient.MySqlDataAdapter
        Dim ds As New DataSet
        da = New MySqlClient.MySqlDataAdapter(cmd)
        da.Fill(ds)

        ProgressBar1.Value = 0
        ProgressBar1.Maximum = ds.Tables(0).Rows.Count
        k = 1

        For ro As Integer = 0 To ds.Tables(0).Rows.Count - 1
             k += 1
             For cl As Integer = 0 To ds.Tables(0).Columns.Count - 1
                  AxSpreadsheet2.Worksheets(1).Cells(k, cl + 1) = 
ds.Tables(0).Rows(ro).Item(cl).ToString
             Next
             ProgressBar1.Value += 1
         Next

But it was very slow. It is possible to use Axspreadsheet.Datasource method 
to bind the dataset values.
Pls guide me.


0
Reply Utf 3/3/2010 1:21:02 PM


0 Replies
853 Views

(page loaded in 0.024 seconds)

Similiar Articles:









7/30/2012 1:47:41 PM


Reply: