SQL Server :: Derived Column Transformation / Add Extra Logic To Derived Column Expression?
Dec 22, 2010
I'm trying to figure out how add extra logic to this derived column expression:
LEN(TRIM(pup_date)) == 0 ? NULL(DT_DATE) : ((DT_DATE)(SUBSTRING(pup_date,5,2) + "-" + SUBSTRING(pup_date,7,2) + "-" + SUBSTRING(pup_date,1,4)))
If there's a 0 in the field the code inserts a null. Otherwise it inserts a date. How can I change this to insert a NULL if a question mark "?" appears in the column?
This is what I tied using the OR operator but it's not working:
LEN(TRIM(pup_date)) == 0 || LEN(TRIM(pup_date)) == "?" ? NULL(DT_DATE) : ((DT_DATE)(SUBSTRING(pup_date,5,2) + "-" + SUBSTRING(pup_date,7,2) + "-" + SUBSTRING(pup_date,1,4)))
View 2 Replies
Similar Messages:
Nov 15, 2010
In a recent post, I expressed a need to access the properties for the body using declarative syntax, see
Contentplaceholder for replacing attributes?
But, the syntax confuses the editor which is not acceptable.
My hypothesis for a workable solution is to make the change in code. To derive a class from System.Web.UI.Page with extended functionality. However, I want for the designer to be able to still use declarative syntax to set the body tag.
I do not want to have to change any code in my aspx web pages except that they derive from base I want to be able to set these properties using declarative syntax, merely by adding a tag in the derived page I'm not immediately sure how to go about doing this because it doesn't exactly fit the OOP paradigm and I'm not sure where the changes need to be made.
I can use a findcontrol in the base to see if the placeholder has been added. But, not sure exactly at what point in the page processing lifecycle that I can use this findcontrol. I need to set the body before it renders but also be able to grab something from the declarative code.
View 2 Replies
Oct 25, 2010
Just wanted to know if a singleton class could be inherited and derived.
View 2 Replies
Feb 27, 2010
I have the following query which returns all appointments for a given date, grouped by client and appointment date. For those clients that have multiple appointments on that date, I get multiple rows, one for each appointment time. I only want the earliest appointment for each client, which would result in only one row per client. If I add the MIN function to SchedTime, I'm forced to put all columns in a GROUP BY clause, which isn't what I want.Can I use a derived table and/or MIN(Schedule.SchedTime) to achieve this? Or is my thinking wrong to begin with?
"SELECT Schedule.ClientId, " +
"ClientData.FirstName, " +
"ClientData.LastName, " +
[code]...
View 2 Replies
Feb 2, 2011
Is it possible for a derived controls to inherit his base control skin.
Say I am deriving a control from TextBox, is it possible for the derived control to inherit the skin settings for Textbox or do they need to be defined again?
I am applying the default skins to all controls through the styleSheetTheme Page property I am using the Devexpress asp.net controls if that makes any difference.
View 2 Replies
Feb 9, 2010
Can anyone point me to where i can find a documentation about css, masterpage and derived pages in VS2008. I used them in VS2005 but it looks like it's almost impossible on VS2008. or it's just me.
View 4 Replies
Sep 2, 2010
I have a application which uses webparts and 1 control is also a Script Control.So my user controls are derived from System.Web.UI.WebControls.WebParts.WebPart which makes them webpartsI have everything setup and working fine as far as the personalization and webpart goes... every thing displays and works fine.Except that 1 of my control needs to do a bit of work in the OnPreRender event and it turns out that event only gets fired when a user is loged in the application
View 1 Replies
Feb 16, 2010
I have written a page which uses Linq to query the database and bind the resulting IQueryable to a datagrid. I have a partial class which contains extra properties which derive their values based on other values brought in from the database.
Sorting works fine on fields that are actually in the database but not for the derived fields. When I attempt to sort on such a field I get an error saying "The member 'Trip.Difference' has no supported translation to SQL. how to allow sorting on these derived fields?
View 2 Replies
Apr 26, 2010
I spent an hour googling and trying. No success. I want to get the digits behind the dot or comma for my calulcated column:
[code]...
But it just shows me a 0 and no other digits.
View 2 Replies
Nov 5, 2010
I can't find the answer to this easy question, because I don't know the terminology I am looking to use. I have 2 tables, one that is a Users Table, and another (UserProfiles) that extends the Users table to include more info, like Age, Sex, Weight, etc.I am using the Entity Framework as my model, and the UserProfiles inherits from the Users table on a 1:1 basis.
All I need to do is the learn the syntax, that allows LINQ to Entities to query only some of the data from UserProfiles. For example, maybe I only need Sex and Weight, but not Age.
[Code]....
View 4 Replies
Apr 21, 2010
I have a few applications/websites running with LINQ to SQL and the other day I decided to go ahead and optimize some of the queries, etc and I found that the size for variable length data types is derived from the parameter value instead of the column actual size? for example a column is defined as nvarchar(30). when I use linq to query that column with a value that's 5 characters long the parameter in sp_executesql will be defined as nvarchar(5)...this causes a major procedure cache bloat even for a small utility site that has a lot of queries is there a way to optimize this?
View 1 Replies
Aug 31, 2010
my user controls are derived from System.Web.UI.WebControls.WebParts.WebPart which makes them webparts.I have everything setup and working fine as far as the personalization and webpart goes... every thing displays and works fine.Except that 1 of my control needs to do a bit of work in the OnPreRender event and it turns out that event only gets fired when a user is loged in the application.
Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
If Not Me.DesignMode Then
Me.isloaded = True
' Test for ScriptManager and register if it exists
sm = ScriptManager.GetCurrent(Page)
[code]...
View 1 Replies
Feb 16, 2010
I have a class that derives from System.Web.UI.Page and have set my pages to derive from this custom page class instead of Page. At runtime, the controls are never initialized and throw a NullReferenceException. I've changed some class names and namespaces in the pasted code to protect the innocent. The only thing that I currently override in my PageBase is OnPreLoad and I do call the base.OnPreLoad. I'll eventually add more functionality to this PageBase but for now all that it has is this:
[Code]....
I've tried putting this into a class library (with System.Web referenced) and I've also tried moving the class into the web application and had the same results either way. As another strange twist, I have another class with derives from PageBase called IndexPageBase and it doesn't have this problem:
[Code]....
[Code]....
[Code]....
View 7 Replies
Feb 22, 2011
I want to add a class and initialize a JS funcion behind my nested masterpage which is being dervised from an other master page. But when I add the following code in the PageLoade event in the code behined of my derived page then it give the folowing error
Exception Details:
System.NullReferenceException: Object reference not set to an instance of an object.
CODE-
[Code]....
[Code]....
[Code]....
View 3 Replies
Oct 8, 2010
MSAJAX: overrides of toString() and other Object methods do not propagate to derived classes
View 1 Replies
Jun 21, 2010
How do you add an extra column in a datatable which will be used for another query
View 3 Replies
Jan 16, 2011
I want to copy data from a table[tblExcel][No.of columns:2] to another table[ev_event] which has 5 columns, 2 columns from the another table, 3 columns from user defined value
[code].....
View 4 Replies
Nov 15, 2010
I have some (probably very basic) questions about developing custom controls. I am wanting to derive a set of button controls, and the first one I have started on is a "DeleteButton", that has a additional property (DeleteConfirmationText) that is built into the OnClientClick attribute. To get that added, I overrode the Render method as follows:
[Code]....
This all works well. Now, I will add some logic to make sure that there is some text in the DeleteConfirmationText property, but that isn't the intent of my question.
What I am also wanting to do is to override some of the default property values, so I added that to the default constructor:
[Code]....
Now, in the designer in VS2008, and I look at the properties for the control, there isn't a default value shown in the "Properties" section, and the Causesvalidation still shows the underlying classes default value of "True". As well, in design mode, where the GridView control that containse my DeleteButton control would be displayed, there is an error box "There was an error rendering the control. 'Are you certain you want to delete this attorney?' cound not be set on property 'DeleteConfirmationText'. Here's the markup where I am defining the deletebutton control:
[Code]....
What am I doing wrong?
View 5 Replies
Oct 5, 2010
I'm getting a blank column when switching to another page using the default pager in the telerik radgrid. As data for each row, it shows the type of data i am using for the rows (SearchRecord)
Anyone have any clues as to why this may be happening? It doesn't show up on initial population of the grid, but only when I do paging. My columns are built dynamically but i confirmed that when my columns are built, they are the correct number.
View 1 Replies
Sep 7, 2010
I have a gridview with the following columns pid Location
I would like to add an extra column called quantity, that could be used to get a user input. How do i go about doing that? See illustration below
pid Location quantity
View 9 Replies
Feb 18, 2011
I want to get extra column with links in my gridview which changes on click and updates my database
View 8 Replies
Aug 10, 2010
I have a table converted from Access and the identity keys were lost. Now I need to make the id column the identity column, but it already has a lot of null values, how do I auto generate integer values for the null rows? The row ids are incremented, so if there is a way to auto increment the ids
View 7 Replies
Feb 17, 2011
I am creating dynamic view using two tables.one is emp_Tbl and 2nd table emp_salary which is created dynamically .creating view it gives error 'Create View or Function failed because no column name was specified for column 2.
my code is: create view [dbo].[Emp_Salary_pay] as select dbo.Emp_Tbl.Emp_Status, (select column_name + ', ' from information_schema.columns where table_name = 'Emp_salary' ) FROM dbo.Emp_Tbl INNER JOIN dbo.Emp_Salary ON dbo.Emp_Tbl.Emp_Id = dbo.Emp_Salary.Pay_Emp_Id
View 5 Replies
Sep 4, 2010
I would like to know how to add some additional child nodes to a custom user control class derived from System.Web.UI.Control. For example currently I have a control that contains no child nodes and on the design surface looks like the following.
<cust:MyCustomControl id="ctlMyCustomControl" runat="server" attribute1="somevalue" attribute2="somevalue" ></MyCustomControl>
What I am looking for is to have the ability to add n number of child nodes to this control from the design surface and then access their values from the code. So adding to the control stated above.
<cust:MyCustomControl id="ctlMyCustomControl" runat="server" attribute1="somevalue" attribute2="somevalue" >
<childnode1>value1</childnode1>
<childnode2>value2</childnode2>
</MyCustomControl>
It is not clear to me how to access the child nodes.
View 2 Replies
Aug 20, 2010
Since we can access the private data member of base class in the derived class with the help of friend function. How can we do the same in C# asp.net? I mean whats the alternative of friend function in C# asp.net
View 2 Replies