I was excited to see where someone was doing exactly what I wanted to do with the sqldatasource and so I adapted it to my purposes but while I can run it without error I also get no data with or without entering data in the text boxes.
Here it the a link to the thread that inspired me
Reference link for what I used:
You'll note the answer by Paris is what I've adapted:
I've tried both techniques illustrated with the same results so I am really baffled. Here is my aspx code:
<asp:SqlDataSource ID="InventoryList" runat="server" ConnectionString='<%$ ConnectionStrings:CMDB_testConnectionString %>' SelectCommand="SELECT [AssetID], [AssetType], [AssetName], [AssetShortDesc], [AssetLongDesc], [AssetAddNotes], [AssetManuf], [AssetModel], [AssetTag], [AssetSerialNum], [AssetAcqDate], [AssetDTAssetID], [AssetLocGrp], [AssetLoc1], [AssetLoc2], [AssetLoc3], [AssetParent], [AssetStatus], [AssetPropType], [AssetPrimUser], [AssetEntered], [AssetEnteredBy], [AssetOwner], [AssetCompany], [AssetPriIPAddr], [AssetPriMACAddr], [AssetPriOS], [AssetPriOSSP], [AssetNotes], [AssetAdminGrp], [AssetOrgID], [AssetOperType], [AssetOperStatus] FROM [cmdb_assets]
WHERE [AssetName] = CASE @AssetName THEN [AssetName] END AND [AssetType] = CASE @AssetType THEN [AssetType] END AND [AssetManuf] = CASE @AssetManuf THEN [AssetManuf END AND [AssetModel] = CASE @AssetModel THEN [AssetModel] END">
Followed by:
<SelectParameters>
<asp:ControlParameter Name="AssetName" ControlID="AssetNameTbx" Type="String" />
<asp:ControlParameter Name="AssetType" ControlID="AssetTypeTbx" Type="String" />
<asp:ControlParameter Name="AssetManuf" ControlID="AssetManufTbx" Type="String" />
<asp:ControlParameter Name="AssetModel" ControlID="AssetModelTbx" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
As the first thread responder was shooting for, what I want to do is allow input of information in one or more text boxes and then filter the results onto my gridview via this select. Thoughts? Ken...
Thought I would provide an output of the results of the two examples I've used above and the latest that I just tried supplied by another forum member tested on 2014 which also did the same nodata return result. Just for perspective of the result. Really of no value but still.
Ken...
What the datasource ended up as:
<asp:SqlDataSource ID="InventoryList" runat="server" ConnectionString='<%$ ConnectionStrings:CMDB_testConnectionString %>' SelectCommand="SELECT [AssetID], [AssetType], [AssetName], [AssetShortDesc], [AssetLongDesc], [AssetAddNotes], [AssetManuf], [AssetModel], [AssetTag], [AssetSerialNum], [AssetAcqDate], [AssetDTAssetID], [AssetLocGrp], [AssetLoc1], [AssetLoc2], [AssetLoc3], [AssetParent], [AssetStatus], [AssetPropType], [AssetPrimUser], [AssetEntered], [AssetEnteredBy], [AssetOwner], [AssetCompany], [AssetPriIPAddr], [AssetPriMACAddr], [AssetPriOS], [AssetPriOSSP], [AssetNotes], [AssetAdminGrp], [AssetOrgID], [AssetOperType], [AssetOperStatus] FROM [cmdbv_Assets_CInTrac] where AssetID=isnull(@AssetID,AssetID) and AssetName=isnull(@AssetName,AssetName) and AssetType=isnull(@AssetType,AssetType) and AssetManuf=isnull(@AssetManuf,AssetManuf) and AssetModel=isnull(@AssetModel,AssetModel) and AssetTag=isnull(@AssetTag,AssetTag) and AssetSerialNum=isnull(@AssetSerialNum,AssetSerialNum) and AssetDTAssetID=isnull(@AssetDTAssetID,AssetDTAssetID) and AssetLocGrp=isnull(@AssetLocGrp,AssetLocGrp) and AssetLongDesc=isnull(@AssetLongDesc,AssetLongDesc) and AssetOrgID=isnull(@AssetOrgID,AssetOrgID) and AssetPriIPAddr=isnull(@AssetPriIPAddr,AssetPriIPAddr) and AssetStatus=isnull(@AssetStatus,AssetStatus)" CancelSelectOnNullParameter="false">