Friday, January 22, 2010

If there is no any record in database then how to assign value to textbox control in vb6?

If (rs1.EOF = True Or rs1.EOF = True) Then


If IsNull(rs1.Fields(';balance';)) Then


txtperiod.Text = ';0';


Else


txtperiod.Text = rs1.Fields(';balance';)//it show error over here


End IfIf there is no any record in database then how to assign value to textbox control in vb6?
Your statment contains an error





If there is no record in the database then rs1.bof AND rs1.eof will be true. so the right syntax would be:





If (rs1.BOF = True AND rs1.EOF = True) then


txtperiod.Text = ';0';


Else


txtperiod.Text = rs1.Fields(';balance';)


End If

No comments:

Post a Comment