|
-
Jan 23rd, 2008, 07:09 AM
#1
Thread Starter
Junior Member
FlexGrid Problem
Hello,
I have this method that accepts sqlcommand (string) and FlexGrid, I want to populate the flexGrid with the result of the sql command, as shown below.
Problem is, it gives me an error.
Public Sub FillFlexGrid(ByVal sqlcmd As String, ByVal Flxgrid As VSFlex8U.VSFlexGrid)
Dim tmpTable As DataTable
dim rw as integer = 0
dim cl as integer = 0
Try
con.Open()
Dim dtset As New DataSet
Dim dtad As SqlDataAdapter = New SqlDataAdapter(sqlcmd, con)
dtad.Fill(dtset, "tmpTable")
tmpTable = dtset.Tables("tmpTable")
For Each row As DataRow In tmpTable.Rows
For Each col As DataColumn In tmpTable.Columns
With Flxgrid
.TextMatrix(rw, cl) = row(col)
cl += 1
End With
rw += 1
Next
Next
Catch ex As SqlException
MessageBox.Show(ex.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
con.Close()
End Try
End Sub
thanks....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|