Results 1 to 5 of 5

Thread: DGV Column as Select String

Threaded View

  1. #1

    Thread Starter
    Member gbfai87's Avatar
    Join Date
    Oct 2017
    Posts
    33

    DGV Column as Select String

    Is there any problem in my codes.
    I just want to get the value from my database that the same in my DGV Column.

    I didnt get any error, but the column shows nothing.
    here is my code.
    Code:
    Dim col2 As New DataGridViewTextBoxColumn
    col2.DataPropertyName = "PropertyName"
    col2.HeaderText = "Brand"
    col2.Name = "Brand"
    DGVImport.Columns.Add(col2)
    
    For rowIndex = 0 To DGVImport.RowCount - 1
    Dim previousBalance = DGVImport.Rows(rowIndex).Cells("LicensePlateNo").Value.ToString
    Dim Brand As String
    For i = rowIndex To DGVImport.Rows.Count - 1
    Dim LoadBrand As String = "Select Brand from TblBrand where PlateNo=@PlateNo"
    siemdi = New OleDbCommand(LoadBrand, cns)
    siemdi.Parameters.AddWithValue("@PlateNo", previousBalance)
    DGVImport.Rows(rowIndex).Cells("Transporter").Value = Brand
    Next
    Next
    Last edited by si_the_geek; Apr 22nd, 2019 at 07:18 AM. Reason: added Code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width