Datagrid problem

I am running the procedure below on my vb.net page when ever the datagrid is clicked.  it is picking up the correct screenid number but when the page is viewed if the dataset has no records in it the datagrid remains keeps the same records.  Can someone tell me how to get it to switch to no records if none are returned.

Thanks

   SqlDataAdapter6.SelectCommand.Parameters("@paramid").Value = screenid
     SqlDataAdapter6.Fill(DsPAScreen61, "tblPAPhoneVoucher")
        DataGrid1.DataSource = (DsPAScreen61)
        DataGrid1.DataMember = "tblPAPhoneVoucher"
running32Asked:
Who is Participating?
 
newyuppieConnect With a Mentor Commented:
maybe the dataset is not getting cleared before the fill. try one of 2 options

1) set the ClearBeforeFill property to TRUE for the dataset

or

2)
try adding
DsPAScreen61.Clear()
before filling the dataadapter
0
 
XeavnCommented:
Try using

DataGrid1.DataBind()

after setting the DataSource.
0
 
running32Author Commented:
It tells me datagrid is not a member of form.datagrid
0
 
running32Author Commented:
That's it thanks
0
 
newyuppieCommented:
your welcome.
thanks for the grade
NY
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.