get the value from textbox,,to execut query

Mar 30 2010 8:07 AM
hi,,,this my query as given below


select b.RegNo,
     b.FirmName, 
       isnull(a.BalTaxAmount,0) + isnull(a.BalPenalty,0) + isnull(a.BalNoticeFee,0) DueAmount,
       isnull(a.BalInterest,0) InterestAmt,
  datediff (day,  DueDate ,getdate()) duedays,
       b.autoid IDtblPTForm3
from tblPTForm3Balance a, tblPTForm3 b
where a.IDtblPTForm3 = b.AutoID
 and a.LocationID = <LOcationID>
 and a.YearID = <YearID>
 and (isnull(a.BalTaxAmount,0) + isnull(a.BalPenalty,0) + isnull(a.BalInterest,0) + isnull(a.BalNoticeFee,0)) > 0
 and convert(datetime,convert(varchar(10),a.DueDate + <days>,101))  <= convert(datetime,convert(varchar(10),getdate(),101))


i want to get the values of <days> from textbox and <location ID> and <yearId> from dropdownlist.
to execute this query and bind data in a grid..how can i do this.
please provide me code by example..
thank you


Answers (1)