the below code fails to retreive a row when atleast one column doesnt have a value in datagridview.can some one please tell me how to handle Nulls for each column
Dim Rows = _
( _
From row In DataGridView1.Rows.Cast(Of DataGridViewRow)() _
Where Not row.IsNewRow AndAlso CStr(row.Cells(cboNames.Text).Value) = cboValue.Text _
Select ID =
CInt(row.Cells("ID").Value),
Name =
CStr(row.Cells("Name").Value),
DeviceName =
CStr(row.Cells("DeviceName").Value),
IPAddress =
CStr(row.Cells("IPAddress").Value),
WWN =
CStr(row.Cells("WWN").Value),
Location_ID =
CStr(row.Cells("Location_ID").Value),
LocationName =
CStr(row.Cells("LocationName").Value),
Product_Number =
CStr(row.Cells("Product_Number ").Value),
ILOAddress =
CStr(row.Cells("ILOAddress ").Value),
Make =
CStr(row.Cells("Make").Value),
Model =
CStr(row.Cells("Model").Value),
Serial_Number =
CStr(row.Cells("Serial_Number").Value),
Date_Added =
CStr(row.Cells("Date_Added").Value),
Last_Modified_Date =
CStr(row.Cells("Last_Modified_Date").Value),
Environment =
CStr(row.Cells("Environment").Value),
Support_ID =
CStr(row.Cells("Support_ID").Value),
SupportCompany =
CStr(row.Cells("Company").Value)
Order By ID).ToList
Dim Rows = _
( _
From row In DataGridView1.Rows.Cast(Of DataGridViewRow)() _
Where Not row.IsNewRow AndAlso CStr(row.Cells(cboNames.Text).Value) = cboValue.Text _
Select ID =
CInt(row.Cells("ID").Value),
Name =
CStr(row.Cells("Name").Value),
DeviceName =
CStr(row.Cells("DeviceName").Value),
IPAddress =
CStr(row.Cells("IPAddress").Value),
WWN =
CStr(row.Cells("WWN").Value),
Location_ID =
CStr(row.Cells("Location_ID").Value),
LocationName =
CStr(row.Cells("LocationName").Value),
Product_Number =
CStr(row.Cells("Product_Number ").Value),
ILOAddress =
CStr(row.Cells("ILOAddress ").Value),
Make =
CStr(row.Cells("Make").Value),
Model =
CStr(row.Cells("Model").Value),
Serial_Number =
CStr(row.Cells("Serial_Number").Value),
Date_Added =
CStr(row.Cells("Date_Added").Value),
Last_Modified_Date =
CStr(row.Cells("Last_Modified_Date").Value),
Environment =
CStr(row.Cells("Environment").Value),
Support_ID =
CStr(row.Cells("Support_ID").Value),
SupportCompany =
CStr(row.Cells("Company").Value)
Order By ID).ToList
lucky