I have a ASPX.NET DataGrid and im trying to USE a select LIKE 'X'% from a table that has 1 field called location. im trying to display the locations that start with a certain letter (example wxxx,axxx,fxxx,) in different columns in my data grid.
I am trying to display more than 1 column in my datagrid using a SP shown below. The issue is that the table locationMaster has only 1 field called location. The field Location has mutable location numbers that start with different letters (example w1002, w1003, 00159, 00526). What I would like to do is use a sp to display the wxxxx locations in one column in my datagrid and 0xxxx in another. If i just simply run
SELECT DISTINCT
LM.LOCATION AS 'LOCATIONS',
LM.COUNTLEVEL AS 'COUNTLEVEL'
FROM
SOH S WITH(NOLOCK)
JOIN LOCATIONMASTER LM ON LM.LMID = S.LMID
WHERE
LM.COUNTLEVEL = 1
AND LM.LOCATION NOT IN ('RECOU','PROBLEM','TOSTOCK','PYXVLOC')
My Datagrid has only 1 column with all the locations and the page will be very lengthy If i could somehow use LIKE 'W%' AND LIKE '0%' in a sp and create two columns
SELECT
DISTINCT LM.LOCATION AS '0 LOCATIONS' ,
LM.COUNTLEVEL AS 'COUNTLEVEL'
FROM SOH S WITH(NOLOCK)
JOIN LOCATIONMASTER LM ON LM.LMID = S.LMID
WHERE
LM.COUNTLEVEL = 1 AND
LM.LOCATION NOT IN ('RECOU','PROBLEM','TOSTOCK','PYXVLOC')
AND LM.LOCATION LIKE '0%'
SELECT
DISTINCT LM.LOCATION AS 'A LOCATIONS' ,
LM.COUNTLEVEL AS 'COUNTLEVEL'
FROM SOH S WITH(NOLOCK)
JOIN LOCATIONMASTER LM ON LM.LMID = S.LMID
WHERE
LM.COUNTLEVEL = 1 AND
LM.LOCATION NOT IN ('RECOU','PROBLEM','TOSTOCK','PYXVLOC')
AND LM.LOCATION LIKE 'A%'**
And here is my datagrid code
<Columns>
<asp:BoundColumn DataField="COUNTLEVEL" Visible="false"/>
<asp:TemplateColumn HeaderText="LOCATION">
<ItemTemplate>
<a href='confirmRecount.aspx?Var=<%# DataBinder.Eval(Container.DataItem ,"0 LOCATIONS")%>'>
<%# DataBinder.Eval(Container.DataItem, "0 LOCATIONS")%>
</a>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>