I Used This Code To Fill FlexGrid
But The Result Is Fill All FlexGrid Rows by The First Row On The DataReader
It May be Loop Statment Error
Please Help
Code:Dim mycmd As New SqlCommand("Select ItemID,ItemName,Quantity,unitPrice,Total,Remarks From Pur_Invoice_Details where InvID = " & txtInvID.Text & "", MyConn) MyConn.Open() Dim myReader As SqlDataReader myReader = mycmd.ExecuteReader While myReader.Read Dim x As Integer For x = 0 To Flex1.Rows - 1 Flex1.set_TextMatrix(x, 1, myReader.GetValue(0)) Flex1.set_TextMatrix(x, 2, myReader.GetString(1)) Flex1.set_TextMatrix(x, 3, myReader.GetValue(2)) Flex1.set_TextMatrix(x, 4, myReader.GetValue(3)) Flex1.set_TextMatrix(x, 5, myReader.GetValue(4)) Flex1.set_TextMatrix(x, 6, myReader.GetString(5)) Next End While myReader.Close() MyConn.Close()![]()


Reply With Quote