Hi,
I have a grid view in my web form and have implemented the following gridview enquiry whereby i need to select records based on the string value "Txt_PName" and Date Value "PDate", both values are in the form. When I enquire only with the Date, the gridview returns rows but when i add the textbox in the where clause, it returns error as shown below:
System.Data.SqlClient.SqlException: 'Cannot find either column "Txt_ParentName" or the user-defined function or aggregate "Txt_ParentName.Text.Trim", or the name is ambiguous.'
Here is the sample code:
SelectCommand="SELECT [FullName], [PDate], [PType], [PStatus], [PName], [TransTimeStamp] FROM [PTransMaster_Tbl] Where [PDate] = CAST(GETDATE() as date) and PName = Txt_PName.Text.Trim() Order By PDate DESC">
Kindly advise.
Thanks
Sachin SinghPosted Jan 26, 2023, 9:55 AM
Modify your select command as
Ahmed KhalidPosted Jan 26, 2023, 3:56 PM
Thank you Sachin. I applied the changes it worked