Showing posts with label substitute. Show all posts
Showing posts with label substitute. Show all posts

Wednesday, March 28, 2012

substitute for nested select query

I have a series of select queries that use the nesting method but are
creating such a huge query that the server can't handle it. The IN section
in some cases are so large that I can't even troubleshoot it in Query
Analyzer because it's larger than 64k. Is there another way to write:

SELECT t1.col1, t1.col2
FROM table1 t1
WHERE EXISTS
(
SELECT t2.col1, t2.col2
FROM table2 t2
WHERE t2.col2 IN ('1','2','3','4'...<there could be thousands of
list items here>
)

_____
DC GWHy dont you store them in a table ? Would be much easier to maintain, you
ould additionaly activate / deactivate some entries here:

Create Tabel MyValues
(
MyValue varchar(200),
Acitvated bit
)

SELECT t1.col1, t1.col2
> FROM table1 t1
> WHERE EXISTS
> (
> SELECT t2.col1, t2.col2
> FROM table2 t2
> WHERE t2.col2 IN
(Select * from myVales where Activated =1 )

HTH, Jens Suessmeyer.

--
http://www.sqlserver2005.de
--

"DC Gringo" <dcgringo@.visiontechnology.net> schrieb im Newsbeitrag
news:e9nOtz%23TFHA.580@.TK2MSFTNGP15.phx.gbl...
>I have a series of select queries that use the nesting method but are
>creating such a huge query that the server can't handle it. The IN section
>in some cases are so large that I can't even troubleshoot it in Query
>Analyzer because it's larger than 64k. Is there another way to write:
> SELECT t1.col1, t1.col2
> FROM table1 t1
> WHERE EXISTS
> (
> SELECT t2.col1, t2.col2
> FROM table2 t2
> WHERE t2.col2 IN ('1','2','3','4'...<there could be thousands of
> list items here>
> )
> _____
> DC G
Create a table with the values (one column, multiple rows) and do a subquery inside your IN (or
EXISTS).

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/

"DC Gringo" <dcgringo@.visiontechnology.net> wrote in message
news:e9nOtz%23TFHA.580@.TK2MSFTNGP15.phx.gbl...
>I have a series of select queries that use the nesting method but are creating such a huge query
>that the server can't handle it. The IN section in some cases are so large that I can't even
>troubleshoot it in Query Analyzer because it's larger than 64k. Is there another way to write:
> SELECT t1.col1, t1.col2
> FROM table1 t1
> WHERE EXISTS
> (
> SELECT t2.col1, t2.col2
> FROM table2 t2
> WHERE t2.col2 IN ('1','2','3','4'...<there could be thousands of list items here>
> )
> _____
> DC G
First of all, no need to post a question to all the groups in your
subscription list.
You should have posted only to microsoft.public.sqlserver.programming

How is the list being passed into the query?

Take a look at:
http://vyaskn.tripod.com/passing_ar..._procedures.htm

It may give you a few ideas on how to deal with this.

"DC Gringo" <dcgringo@.visiontechnology.net> wrote in message
news:e9nOtz%23TFHA.580@.TK2MSFTNGP15.phx.gbl...
>I have a series of select queries that use the nesting method but are
>creating such a huge query that the server can't handle it. The IN section
>in some cases are so large that I can't even troubleshoot it in Query
>Analyzer because it's larger than 64k. Is there another way to write:
> SELECT t1.col1, t1.col2
> FROM table1 t1
> WHERE EXISTS
> (
> SELECT t2.col1, t2.col2
> FROM table2 t2
> WHERE t2.col2 IN ('1','2','3','4'...<there could be thousands of
> list items here>
> )
> _____
> DC G
DC Gringo,

The example posted is not using a correlated subquery, the is not a relation
between table1 and table2. Idf it is correct, then you can rewrite it as:

if exists(select * from table2 where col2 in (...))
select col1, col2 from table1

if it was a typo error, then you can create a temporary table to insert the
values in the list, with an associated index and use:

create table #t (c1 int)

insert into #t values(...)
...
create nonclustered index ix_#t_c1 on #t(c1)

SELECT
t1.col1, t1.col2
FROM
table1 as t1
inner join
(
select
t2.col1
from
table2 as t2
inner join
#t
on #t.c1 = t2.col1
) as t3
on t1.col1 = t3.col1

drop table #t
go

AMB

"DC Gringo" wrote:

> I have a series of select queries that use the nesting method but are
> creating such a huge query that the server can't handle it. The IN section
> in some cases are so large that I can't even troubleshoot it in Query
> Analyzer because it's larger than 64k. Is there another way to write:
> SELECT t1.col1, t1.col2
> FROM table1 t1
> WHERE EXISTS
> (
> SELECT t2.col1, t2.col2
> FROM table2 t2
> WHERE t2.col2 IN ('1','2','3','4'...<there could be thousands of
> list items here>
> )
> _____
> DC G
>
>
Raymond, frankly I didn't expect a SQL T-sql answer. I was expecting a
vb.NET answer...but figured I'd try both...I am passing it in via raw SQL
from a .vb component. It is a query building application.

_____
DC G

"Raymond D'Anjou" <rdanjou@.savantsoftNOSPAM.net> wrote in message
news:uTm7J%23%23TFHA.952@.TK2MSFTNGP10.phx.gbl...
> First of all, no need to post a question to all the groups in your
> subscription list.
> You should have posted only to microsoft.public.sqlserver.programming
> How is the list being passed into the query?
> Take a look at:
> http://vyaskn.tripod.com/passing_ar..._procedures.htm
> It may give you a few ideas on how to deal with this.
> "DC Gringo" <dcgringo@.visiontechnology.net> wrote in message
> news:e9nOtz%23TFHA.580@.TK2MSFTNGP15.phx.gbl...
>>I have a series of select queries that use the nesting method but are
>>creating such a huge query that the server can't handle it. The IN
>>section in some cases are so large that I can't even troubleshoot it in
>>Query Analyzer because it's larger than 64k. Is there another way to
>>write:
>>
>> SELECT t1.col1, t1.col2
>> FROM table1 t1
>> WHERE EXISTS
>> (
>> SELECT t2.col1, t2.col2
>> FROM table2 t2
>> WHERE t2.col2 IN ('1','2','3','4'...<there could be thousands of
>> list items here>
>> )
>>
>> _____
>> DC G
>>
>>
>>
Hey DC,

If you have rights to create tables temprorarily, I'd agree with most of the
other posts. A few other ideas follow. Also, can you post more specifics
about what sort of things can be part of the IN clause?

- Are there any patterns you can narrow pieces down to, e.g., CAST( t2.col2
AS int) BETWEEN 1 AND 42?
- Maybe you could use the query to narrow the majority of your data and
either manipulate it on the .NET side or use a DataView to handle the rest
of the trimming.
- Can the logic be "reversed", e.g., if you can have char representations of
numbers ranging '1' to '10000', use NOT IN and supply a smaller set of
non-valid options.

HTH,

John

"DC Gringo" <dcgringo@.visiontechnology.net> wrote in message
news:e9nOtz%23TFHA.580@.TK2MSFTNGP15.phx.gbl...
>I have a series of select queries that use the nesting method but are
>creating such a huge query that the server can't handle it. The IN section
>in some cases are so large that I can't even troubleshoot it in Query
>Analyzer because it's larger than 64k. Is there another way to write:
> SELECT t1.col1, t1.col2
> FROM table1 t1
> WHERE EXISTS
> (
> SELECT t2.col1, t2.col2
> FROM table2 t2
> WHERE t2.col2 IN ('1','2','3','4'...<there could be thousands of
> list items here>
> )
> _____
> DC G

substitute for <span>

asp.net 1.1

for my .aspx web-form , if i set Target Schema = Internet Explorer 5.0 ,
then this line

<span id="NameFirst" name="NameFirst" runat=server></span
causes the error

"the active schema does not support the element 'span'."

what should i use as a substitute for <span> ?That's weird -- span sure is supported by IE5. I can repro your problem only if I switch the schema to IE 3.2/Netscape 3.02 -- in other words, using a schema for a browser before IE4.

For what it's worth, the schema is used for validation in HTML view, but it does not prevent the page from compiling and rendering to the browser. At least, that's my experience while testing this.
Unless you have a good reason for specifying the Target Schema, it would bemuch easier to simply remove that specification. The <span> tag is a very fundamental part of both HTML and ASP.NET, so trying to remove every instance of it would bevery problematic.

However, to answer your question ... you could use a <div> instead.

A <div> is called a "block" element in that each <div> tends to appear "under" the last <div>. (HTML tables are block elements too, as they each generally appear below one another.)

A <span>, on the other hand, is called an "inline" element as each <span> appears "next" to the last <span>. (HTML hyperlinks <a href="http://links.10026.com/?link=..."> are inline elements, as they appear next to the words preceding the hyperlink.)

So, to use a <div> instead of a <span>, you'd need to change it from a "block" element to an "inline" element:

<div id="one" style="display:inline;">...</div>
is pretty much the same as
<span id="two">...</span>

Still, I'd caution again that it would be much easier to remove the Target Schema specification than to try to remove all instances of <span> tags.

substitute data from database into web form

Hello.

Newbie here, I have a field in a database called status with the values "I" or "A". I need to display "Inactive" or "Active" in a gridview or formview web page. How do I substitute these values.

Thanks in advance.

Is this data being displayed in a datalist / datagrid? You can either create a temp table in your sql or modify your code. If you post your code I can show you how, otherwise you can do something like this in your sql:

create table #temp(
activeInactiveField1 char(5)
, activeInactiveField2 char(10)
-- , your other fields here
)

Insert into #Temp(
-- all fields from your existing sql
from all your existing tables

update #temp
set activeInactiveField2 = 'Active'
where activeInactiveField1 = 'A'

update #temp
setActiveInactiveField2 = 'Inactive'
where activeInactiveField1 = 'I'

select * from #Temp
drop table #Temp

Then you can databind the field in your webform to activeInactiveField2


Hello, Thank you for the quick response. Below is my code. As stated I am a newbie and the filed I am working with is status. Thanks a lot.

<%@.PageLanguage="VB"AutoEventWireup="false"CodeFile="Default2.aspx.vb"Inherits="Default2" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

<formid="form1"runat="server">

<div>

<asp:GridViewID="GridView1"runat="server"AutoGenerateColumns="False"DataSourceID="SqlDataSource1"

Style="z-index: 100; left: 0px; position: absolute; top: 0px">

<Columns>

<asp:BoundFieldDataField="Citation"HeaderText="Citation"SortExpression="Citation"/>

<asp:BoundFieldDataField="Type"HeaderText="Type"SortExpression="Type"/>

<asp:BoundFieldDataField="Status"HeaderText="Status"SortExpression="Status"/>

<asp:BoundFieldDataField="Last Name"HeaderText="Last Name"SortExpression="Last Name"/>

<asp:BoundFieldDataField="First Name"HeaderText="First Name"SortExpression="First Name"/>

<asp:BoundFieldDataField="Middle"HeaderText="Middle"SortExpression="Middle"/>

<asp:BoundFieldDataField="DOB"HeaderText="DOB"SortExpression="DOB"/>

<asp:BoundFieldDataField="Violation Date"HeaderText="Violation Date"SortExpression="Violation Date"/>

<asp:BoundFieldDataField="Charge"HeaderText="Charge"SortExpression="Charge"/>

<asp:BoundFieldDataField="Description"HeaderText="Description"SortExpression="Description"/>

<asp:BoundFieldDataField="Disposition"HeaderText="Disposition"SortExpression="Disposition"/>

<asp:BoundFieldDataField="Cost"HeaderText="Cost"SortExpression="Cost"/>

<asp:BoundFieldDataField="Paid"HeaderText="Paid"SortExpression="Paid"/>

<asp:BoundFieldDataField="Balance"HeaderText="Balance"SortExpression="Balance"/>

</Columns>

</asp:GridView>

<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:MUNI_COURTConnectionString4 %>"

ProviderName="<%$ ConnectionStrings:MUNI_COURTConnectionString4.ProviderName %>"

SelectCommand="SELECT * FROM [MUNI_COURT_REC]"></asp:SqlDataSource>

</div>

</form>

</body>

</html>


You can handle this in RowDataBound event of the gridview. To add this event to your gridview, when in design view of Visual Studio, click on gridview once to get the properties window. From that, go to the events window (identified by a small "lightning" icon) and look for RowDataBound event. Double click on this event and an event hadler will created in your code file. Just copy and paste this code there.

protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e) {if (e.Row.RowType == DataControlRowType.DataRow) {if(e.Row.Cells[7].Text =="A") { e.Row.Cells[7].Text ="Active"; }else { e.Row.Cells[7].Text ="Inactive"; } } }

Or you can change your select statement - something like select case status when 'i' then 'inactive' else 'active' end as status from blah blah blah...

By the way, it's never good practice to do a select *.


Hi, try this inline IIF statement to evaulate the status field and display conditional text. You will have to first convert your GridView to a template so you have control over the HTML controls.

<asp:LabelID="LabelStatus"runat="server"Text='<%# IIF(CONVERT.ToString(Eval("Status"))="A","Active", "Inactive") %>'></asp:Label>


Thanks I got that suggestion to work in a gridview and formview. Big Smile

What if I had another field called type that I had to change

"H" to "Harbor"

"C" to "Civil"

"T" to "Traffic"

"L" to "Local"


You can use the same solutions that are marked as answer to extend the functionality. Like in mine, you can access the columns by their index (0 based). So whatever the index of your "Type" column, access it in RowDataBound event, check the text of the cell, and change it accordigly.


Sorry bullpit,

when I run your suggestion I get the following error message

Compiler Error Message:BC30205: End of statement expected.

I believe your suggestion would work best.

I forgot to uncheck the answer message button


Paste your code here. Please use the InsertCode option in the text editor.


Partial Class Default2 Inherits System.Web.UI.Page Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBoundprotected void gridView1_RowDataBound(object sender, GridViewRowEventArgs e) {if (e.Row.RowType == DataControlRowType.DataRow) {if(e.Row.Cells[7].Text =="A") { e.Row.Cells[7].Text ="Active"; } Else { e.Row.Cells[7].Text ="Inactive"; } } } End SubEnd Class

Thanks


learn_asp_fast:

Partial Class Default2 Inherits System.Web.UI.Page Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBoundprotected void gridView1_RowDataBound(object sender, GridViewRowEventArgs e) {if (e.Row.RowType == DataControlRowType.DataRow) {if(e.Row.Cells[7].Text =="A") { e.Row.Cells[7].Text ="Active"; } Else { e.Row.Cells[7].Text ="Inactive"; } } } End SubEnd Class

The piece of code I posted was an event handler for RowDataBound event. An event handler is a method (function) by itself. What you did was that you attached an event handler the way I mentioned (by double clicking the RowDataBound event in designer) but also copied and pasted the event handler that I posted into the event handler that the designer generated. So now you have a function defined in another function, which is not right. Morover, you are using VB and the code I pasted was C#. Change the above code to this:

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBoundIf e.Row.RowType = DataControlRowType.DataRowThen If e.Row.Cells(7).Text ="A"Then e.Row.Cells(7).Text ="Active"Else e.Row.Cells(7).Text ="Inactive"End If End If End Sub

Bullpit,

Thank you very much for your time. I did realize I pasted the code into another function, but neith er way worked for me. I should be able to get this sample to work in other ways for me.

This a very helpful board.


Also, change the column index (7 in the code I posted) to the column index where you want to change the text. That might be the problem. For example, in your gridview, the "STATUS" colum index maybe 4 instead of 7.


Bullpit,

If you do not mind hopw do I get that to work in a Formview?

Thanks in advance

substitute for nested select query

I have a series of select queries that use the nesting method but are
creating such a huge query that the server can't handle it. The IN section
in some cases are so large that I can't even troubleshoot it in Query
Analyzer because it's larger than 64k. Is there another way to write:
SELECT t1.col1, t1.col2
FROM table1 t1
WHERE EXISTS
(
SELECT t2.col1, t2.col2
FROM table2 t2
WHERE t2.col2 IN ('1','2','3','4'...<there could be thousands of
list items here>
)
_____
DC GWHy dont you store them in a table ? Would be much easier to maintain, you
ould additionaly activate / deactivate some entries here:
Create Tabel MyValues
(
MyValue varchar(200),
Acitvated bit
)
SELECT t1.col1, t1.col2
> FROM table1 t1
> WHERE EXISTS
> (
> SELECT t2.col1, t2.col2
> FROM table2 t2
> WHERE t2.col2 IN
(Select * from myVales where Activated =1 )
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"DC Gringo" <dcgringo@.visiontechnology.net> schrieb im Newsbeitrag
news:e9nOtz%23TFHA.580@.TK2MSFTNGP15.phx.gbl...
>I have a series of select queries that use the nesting method but are
>creating such a huge query that the server can't handle it. The IN section
>in some cases are so large that I can't even troubleshoot it in Query
>Analyzer because it's larger than 64k. Is there another way to write:
> SELECT t1.col1, t1.col2
> FROM table1 t1
> WHERE EXISTS
> (
> SELECT t2.col1, t2.col2
> FROM table2 t2
> WHERE t2.col2 IN ('1','2','3','4'...<there could be thousands of
> list items here>
> )
> _____
> DC G
>
>
Create a table with the values (one column, multiple rows) and do a subquery
inside your IN (or
EXISTS).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"DC Gringo" <dcgringo@.visiontechnology.net> wrote in message
news:e9nOtz%23TFHA.580@.TK2MSFTNGP15.phx.gbl...
>I have a series of select queries that use the nesting method but are creat
ing such a huge query
>that the server can't handle it. The IN section in some cases are so large
that I can't even
>troubleshoot it in Query Analyzer because it's larger than 64k. Is there a
nother way to write:
> SELECT t1.col1, t1.col2
> FROM table1 t1
> WHERE EXISTS
> (
> SELECT t2.col1, t2.col2
> FROM table2 t2
> WHERE t2.col2 IN ('1','2','3','4'...<there could be thousands of l
ist items here>
> )
> _____
> DC G
>
>
First of all, no need to post a question to all the groups in your
subscription list.
You should have posted only to microsoft.public.sqlserver.programming
How is the list being passed into the query?
Take a look at:
http://vyaskn.tripod.com/passing_ar..._procedures.htm
It may give you a few ideas on how to deal with this.
"DC Gringo" <dcgringo@.visiontechnology.net> wrote in message
news:e9nOtz%23TFHA.580@.TK2MSFTNGP15.phx.gbl...
>I have a series of select queries that use the nesting method but are
>creating such a huge query that the server can't handle it. The IN section
>in some cases are so large that I can't even troubleshoot it in Query
>Analyzer because it's larger than 64k. Is there another way to write:
> SELECT t1.col1, t1.col2
> FROM table1 t1
> WHERE EXISTS
> (
> SELECT t2.col1, t2.col2
> FROM table2 t2
> WHERE t2.col2 IN ('1','2','3','4'...<there could be thousands of
> list items here>
> )
> _____
> DC G
>
>
DC Gringo,
The example posted is not using a correlated subquery, the is not a relation
between table1 and table2. Idf it is correct, then you can rewrite it as:
if exists(select * from table2 where col2 in (...))
select col1, col2 from table1
if it was a typo error, then you can create a temporary table to insert the
values in the list, with an associated index and use:
create table #t (c1 int)
insert into #t values(...)
...
create nonclustered index ix_#t_c1 on #t(c1)
SELECT
t1.col1, t1.col2
FROM
table1 as t1
inner join
(
select
t2.col1
from
table2 as t2
inner join
#t
on #t.c1 = t2.col1
) as t3
on t1.col1 = t3.col1
drop table #t
go
AMB
"DC Gringo" wrote:

> I have a series of select queries that use the nesting method but are
> creating such a huge query that the server can't handle it. The IN sectio
n
> in some cases are so large that I can't even troubleshoot it in Query
> Analyzer because it's larger than 64k. Is there another way to write:
> SELECT t1.col1, t1.col2
> FROM table1 t1
> WHERE EXISTS
> (
> SELECT t2.col1, t2.col2
> FROM table2 t2
> WHERE t2.col2 IN ('1','2','3','4'...<there could be thousands of
> list items here>
> )
> _____
> DC G
>
>
Raymond, frankly I didn't expect a SQL T-sql answer. I was expecting a
vb.NET answer...but figured I'd try both...I am passing it in via raw SQL
from a .vb component. It is a query building application.
_____
DC G
"Raymond D'Anjou" <rdanjou@.savantsoftNOSPAM.net> wrote in message
news:uTm7J%23%23TFHA.952@.TK2MSFTNGP10.phx.gbl...
> First of all, no need to post a question to all the groups in your
> subscription list.
> You should have posted only to microsoft.public.sqlserver.programming
> How is the list being passed into the query?
> Take a look at:
> http://vyaskn.tripod.com/passing_ar..._procedures.htm
> It may give you a few ideas on how to deal with this.
> "DC Gringo" <dcgringo@.visiontechnology.net> wrote in message
> news:e9nOtz%23TFHA.580@.TK2MSFTNGP15.phx.gbl...
>
Hey DC,
If you have rights to create tables temprorarily, I'd agree with most of the
other posts. A few other ideas follow. Also, can you post more specifics
about what sort of things can be part of the IN clause?
- Are there any patterns you can narrow pieces down to, e.g., CAST( t2.col2
AS int) BETWEEN 1 AND 42?
- Maybe you could use the query to narrow the majority of your data and
either manipulate it on the .NET side or use a DataView to handle the rest
of the trimming.
- Can the logic be "reversed", e.g., if you can have char representations of
numbers ranging '1' to '10000', use NOT IN and supply a smaller set of
non-valid options.
HTH,
John
"DC Gringo" <dcgringo@.visiontechnology.net> wrote in message
news:e9nOtz%23TFHA.580@.TK2MSFTNGP15.phx.gbl...
>I have a series of select queries that use the nesting method but are
>creating such a huge query that the server can't handle it. The IN section
>in some cases are so large that I can't even troubleshoot it in Query
>Analyzer because it's larger than 64k. Is there another way to write:
> SELECT t1.col1, t1.col2
> FROM table1 t1
> WHERE EXISTS
> (
> SELECT t2.col1, t2.col2
> FROM table2 t2
> WHERE t2.col2 IN ('1','2','3','4'...<there could be thousands of
> list items here>
> )
> _____
> DC G
>
>

Substitute Values in Column in Gridview

I have a Gridview bound to an SQLDataSource (see code below). The value of
the "DayOfWeek" column is actually an integer where 0 = Daily, 1=Sunday,
2=Monday, etc. How can I change what is displayed in the column from values
like 1or 2 to "Sunday", "Monday"?

============== Code =================
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"

AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
<Columns
<asp:BoundField DataField="EventName" HeaderText="EventName"
SortExpression="EventName" /
<asp:BoundField DataField="DayOfWeek" HeaderText="DayOfWeek"
SortExpression="DayOfWeek" /
<asp:BoundField DataField="Occurs" HeaderText="Occurs"
SortExpression="Occurs" /
<asp:BoundField DataField="Location" HeaderText="Location"
SortExpression="Location" /
</Columns
</asp:GridViewI finally found an example that I could apply. I created a Select Case
function named GetDayOfWeek to return the string I wanted for each case and
then replaced the Bound Column in the ASP code to:

<asp:TemplateField HeaderText="Day of Week"
<ItemTemplate
<%#GetDayOfWeek(CInt(Eval("DayOfWeek")))%
</ItemTemplate
</asp:TemplateField
Wayne

"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:ut%232Q9SRGHA.4696@.tk2msftngp13.phx.gbl...
>I have a Gridview bound to an SQLDataSource (see code below). The value of
>the "DayOfWeek" column is actually an integer where 0 = Daily, 1=Sunday,
>2=Monday, etc. How can I change what is displayed in the column from values
>like 1or 2 to "Sunday", "Monday"?
>
> ============== Code =================
> <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
> AllowSorting="True"
> AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
> <Columns>
> <asp:BoundField DataField="EventName" HeaderText="EventName"
> SortExpression="EventName" />
> <asp:BoundField DataField="DayOfWeek" HeaderText="DayOfWeek"
> SortExpression="DayOfWeek" />
> <asp:BoundField DataField="Occurs" HeaderText="Occurs"
> SortExpression="Occurs" />
> <asp:BoundField DataField="Location" HeaderText="Location"
> SortExpression="Location" />
> </Columns>
> </asp:GridView>