Hi all,
I have a problem.
Situation:
I have declared a string to hold the data from a query
strSQL=GetPayment(strDateFrm,strDateTo)
cnCMD = New OleDbCommand(strSQL, cnDB)
cnCMD.CommandType = CommandType.Text
rdr = cnCMD.ExecuteReader
If Not (IsNothing(strSQL)) Then
If rdr.Read Then -------> "problem occurs here"
While rdr.Read
I want to ask anyone who can solve me for:
If data from database is empty, what should I do? Because when data is not exist in database, it will fill empty to
DataSet
and
DataReader
will find nothing and skip the step where I put a condition if nothing in database, it will fill "-NA-" string value.
Or can anyone tell me the other code for inserting data from database to
DataSet
.
I'm confused about the answer that I found in search engine because mostly they put the data into something such as
ListView
,
DataGridView
.
It confuses me.
I use an object
objPayment
as medium to retrieve data from database and fill in
DataSet
column.
For example:
If Not (IsDBNull(rdr("intMPAJRecpNo"))) Then
objChqDataRow.strReceiptNo = rdr("intMPAJRecpNo")
Else
objChqDataRow.strReceiptNo = "- NA -"
End If
If someone has the other way from my way to manipulate data from using
DataReader
, kindly help me.