|
Could I use plsql decode to change value of a column in same record after checking for a condition in another column...
SELECT supplier_name,
decode(supplier_id, 10000, 'IBM',
10001, 'Microsoft',
10002, 'Hewlett Packard',
'Gateway') result
FROM suppliers;
|
|
|
|
|
I found 2 solutions :
Objective:
A table having 2 columns flag and amt. If the flag = Y then the amount should be XXX
else the original amount should be printed.
Solution:
#1
select
decode( nvl(flag,'N'), 'Y', 'XXX', to_char(amt,'999.99') ) amt
from Arif_table
/
#2
select
(
CASE when nvl(flag,'N') = 'Y' then
'XXX'
ELSE
to_char(amt,'999.99')
END CASE
) amt
from Arif_table
/
|
|
|
|
|
Hi,
Im developing a property rentals website (.Net 2.0 c#) and need to produce a calendar on which property owners can indicate the availability of their property. Then in turn visitors to the site can view the calendar to see when its book or available.
Can anyone give me some ideas on how to do this, short of adding 365 fields in a database to account for each day of the year??? Any help or even links would be greatly appreciated as ive done some serious searches and cant find anything suitable.
Thanks in advance for your time!
Phil
|
|
|
|
|
It depends on how you want the screen to look like. I would store the date ranges for a particular property in a separate table and use a primary-foreign key to pull the data. If the calendar needs to show availability for a particular property, then you could get the date ranges from the database and set the dates in the calendar with a color or a style you want.
The default calendar in .net would not allow you to select multiple dates, you will have to create a custom control extending the calendar class. Override the OnDayRender property of the calendar and based on the data from database do a tablecell.ApplyStyle(tableitemstyle) for each of the dates.
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
Hi,
Thanks for the reply but its not quite what i was looking for (i dont think).
1) How do i go about recording availability without the user manually selecting every single date on which the property is available.
2) How do i store this data without having 365 data fields per year in which to store the availability of each individual date?
3) I dont quite follow what you mean by 'primary-foreign key'. Excuse my ignorance.
4) PLEASE PLEASE HELP.
Thanks!!!
Phil
|
|
|
|
|
For one of my project, I had to create a yearly calendar to select a list of dates. I created a custom control extending the calendar control, the user could click on any date on the calendar and that would get added into the database. I had added the DataSourceID property to the calendar control and based on the select statement picked the required dates from the database and applied a color to the dates to show it as selected. Clicking on an existing date would remove that particular date from the database and remove the style applied to it.
Lets say for example that your table structure is something like below (I have put tbl in front of table just to indicate its a table name)
tblProperty tblAvailDates
( (
PropertyID, <pk> <-----------> <fk> PropertyID
Description, DateStart,
ContactName, DateEnd
PhoneNo )
) Use an Inner Join on tblProperty and tblAvailDates to pick the date ranges(which is DateStart to DateEnd) using the relation PropertyID. This way you do not store 365 days in a table but store the date ranges of availability(ex: PropertyID: 1010, DateStart: July, 30th 2007, DateEnd: Nov, 30th 2007).
munklefish wrote: 1) How do i go about recording availability without the user manually selecting every single date on which the property is available.
You can use a date picker to pick start and end dates and store it in a listbox or any kind of control you want, and give the user option edit/delete them.
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
Thanks for the excellent and detailed response!!!
This is really helpful and would certainly go along way towards what my clients need. However at rpresent they are being quite demanding in that they are very keen to be able to select individual dates rather than blocks of days.
Do you have any further suggestions by any chance???
Thanks again for your help so far.
Phil
|
|
|
|
|
In that case convert the table to have just one field DateSelected instead of DateStart and DateEnd. Looks like you will end up with a lot of rows.
The custom control I was talking about, had the same requirement as yours, I needed to have the user select individual dates, since the no of rows I had to deal with was less than 50, I had put each row in the database.
The other alternative you may want to do is to put all the dates into an XML string and store that in the database. The XML string can be read into a dataset and you could iterate through each row of the dataset and apply the style.
tblProperty
(
PropertyID,
Description,
ContactName,
PhoneNo,
PropertyDatesXML
) For loading the dates, you can do something like this in the custom control
foreach(DataRow dr in dsPropertyDatesXML.Tables[0].Rows)
{
} To add individual dates into the database, overide the OnSelectionChanged() of the control and store them in an arraylist/list and when your storing it into the database, create the XML string from the list and store it into the database..
I am not sure about the performance. I guess you will get some more ideas from rest of the people and you could combine the ideas to accomplish what your looking for.
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
Thanks again for your help!
|
|
|
|
|
I'm working in a web application in ASP.NET (c#), and time ago I discovered that I can open with browser pages with the incorrect url, with the only condition that the page name is right.
To give you a practical explanation:
/Admin/
File1.aspx
/FrontEnd/
File2.aspx
/Login.aspx
All these queries give me results:
//localhost/project/Admin/File4.aspx
//localhost/project/FrontEnd/File1.aspx
//localhost/project/Admin/Login.aspx
//localhost/project/FrontEnd/Login.aspx
When I open "//localhost/project/Admin/Login.aspx" or "//localhost/project/FrontEnd/Login.aspx" CSS and images are not loaded, but "//localhost/project/Admin/File4.aspx" or "//localhost/project/FrontEnd/File1.aspx" they are. Even if i put anything instead of "/Admin/" or "/FrontEnd/" it displays the page you request.
It's strange for me, this sounds to me like Mod_Rewrite (URLRewrite) but i never used this in this project.
Any ideas?
Francisco
-- modified at 13:31 Tuesday 31st July, 2007
|
|
|
|
|
in the click event of a ImageMap control I need to know the x y position of the click relating to the Image(not the window)... Any know of a way?
|
|
|
|
|
Can any one give me code of converting HTML page to PDF in ASP.NET.
Thanks in Advance.
|
|
|
|
|
Hi Reader(s), I'm relatively new to ASP.NET so be gentle with me please!
I have a website - written in ASP.Net - the client has just asked if I could provide a password protected home page so they can control the access initially - they want to use one account. I already have a login (for a CMS) on the home page for users to access their particular data records so I am wary of any potential issues. Can anyone help with providing a possible solution? Thanks.
Thanks in anticipation. I-S
|
|
|
|
|
|
Hi,
In my application I am having two parts one is user part and second one is Admin part.
In user part I am using so many controls like Panel, Wizard, Gridview, Textboxes, Labels.. to enter data. In my Admin part I am using the same screens that user used to enter data. In Admin part I am showing the enter data to him to approve.
So same screens are used in both user and Admin. So I want to develop one User control with all the above controls in user screen and want to use the User Control in the Admin part.
In User Control I am putting so many checkboxes buttons . How to handle those button events in the aspx application which is using the user control.
Thanks
|
|
|
|
|
Is it correct to read from web.config file in the following way? i am using asp.net 2.0 VS 2005.I get the following error
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
anmar.SharpWebMail.UI.Login.Login_Click(Object sender, EventArgs args) in login.cs:75
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
The point where the error is shown is
int login_mode = (int)Application["sharpwebmail/login/mode"];
Are application variables available in asp.net 2.0
|
|
|
|
|
sankar.K wrote: Are application variables available in asp.net 2.0
Yes, but set them in global.asax, not web.config
|
|
|
|
|
Consider i have a web.config like this
<configuration>
<configsections>
<sharpwebmail>
<general
default_lang="en"
="" title="[general title] configuration setting">
<login
title="[login title] configuration setting"
="" mode="1" append="" serverselection="auto" enablequerystringlogin="false">
How do i get the value of mode in login section in my code?
|
|
|
|
|
I think you can use something aliong the lines of
ConfigurationSettings.SectionName("KeyName")
Try googling "asp.net 2.0 web.config reading" or some such...
|
|
|
|
|
I want to close my page and open another url outside of my local pages.
example
page1.aspx(close)
www.google.com(open)
when i use the server.Transfer it wont do it?
Thanks in advance.
|
|
|
|
|
you can't server.transfer to a file outside of your web app
brsecu wrote: I want to close my page and open another url outside of my local pages.
?? ...just link to it...
|
|
|
|
|
Yes but how. I know it seems like a simple question but I want to do it out of the aspx.cs code not html. How do i link to it.
|
|
|
|
|
Response.Redirect("http://www.google.com");
for example... is that what you want?
|
|
|
|
|
|
Hi,
after registering the user, I ask him to confirm his membership, and after he confirm I use this code to approve him (before he couldn't enter the site):
<br />
MembershipUser User = Membership.GetUser(username);<br />
User.IsApproved = true;
but unfortunately, it doesn't approves him, it changes its value only during the debugging.
Does anybody now, why?
Thank you
|
|
|
|