DataSource Controls :: Data Types For Derived Or Calculated Columns?

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


Similar Messages:

DataSource Controls :: DataTable Calculated Columns - "Total" Comes Out Blank

May 14, 2010

I am having problem with calculated columns in the following code

[Code]....

orderDT is the DataTable. When "Extra" column has nothing (I am NOT using Default), "Total" comes out to be blank? "Price" will have a value (always) "Extra" may not have any value

View 7 Replies

ADO.NET :: Querying Derived Types But Only With Specific Values / LINQ To Entities?

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

DataSource Controls :: Derived Table And MIN Function?

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

DataSource Controls :: Get Calculated Field Into SQL?

Jan 14, 2011

At the top of my form I have some code that calculates a field

[Code]....

In my form I have this code. What changes below do I need to make to have the value of Date in XXXX?

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:sqlConnection %>"
SelectCommand="SELECT NumPeople, Date1,Time1,Venue FROM People_Count WHERE ((Date1=@ArvDate and Time1 >= '06:00:00.000') or (Date1=XXXX and Time1 <= '06:00:00.000')) and Venue='F & B' ORDER BY Date1 ASC, Time1 ASC">
<SelectParameters>
<asp:QueryStringParameter Name="ArvDate" QueryStringField="ArvDate" />
</SelectParameters>
</asp:SqlDataSource>

View 2 Replies

DataSource Controls :: SUM Function On A Calculated Field Does Not Work SQL 2005?

Mar 20, 2010

I have a simple query on a table to calculate the sum of a field (This field is a calculated field from within SQL 2005)SELECT SUM(RunTime) AS TotaL FROM TimeSheets.It errors out with: Error Message: Operand data char type char is invalid for sum operator.If I use the MAX or MIN function, no isssues. The data in this field is numeric.

View 4 Replies

DataSource Controls :: Datatable Data Types And Command Parameter Datatype?

Apr 7, 2010

I am using VS 2008.I am building a datatable of records to be inserted into a SQL Server 2005 table.
The program loops through this table and builds a SqlParameter for each DataColumn in the datatable. The SqlParameters are used in the SQL Insert statement.

The field I am having a problem with is of type 'bit' in the database table and has no default value and cannot be nulls. The field is called 'Active' The meaning of this field in the application is Boolean i.e True or False. When inserting the record, I wish to default the field to "False".

When I define the columns in the datatable I am forced to use the following code to build the datatcolumn containing the boolean field i.e. dtcActive.DataType = GetType(Boolean) as there is no GetType(Bit)

Dim dtcActive As New DataColumn("Active")
dtcActive.DataType = GetType(Boolean)
dtcActive.Unique = False
dtcActive.AllowDBNull = False
dtcActive.DefaultValue = False
dtProviderDayDetails.Columns.Add(dtcActive)

However, when I build the SqlParameter I am forced to use this:

If field.ColumnName = "Active" Then
prm.SqlDbType = SqlDbType.Bit
prm.Value = "False"
End If

This is because there is no SqlDbType.Boolean. The problem I have is there is no value I have been able to give the SqlParameter that is accepted by the Insert statement. It complains that the boolean field cannot be null on Insert.

View 1 Replies

DataSource Controls :: Data Types Text And Varchar Are Incompatible In The Equal To Operator?

Jul 4, 2010

I get the following error: The data types text and varchar are incompatible in the equal to operator.here's my code (PageName is a string Parameter) :

SqlConnection sql = SQLconnection();
en();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "Select title, text, postdate, sticky from articles where pagename = @pagename;";
[code]...

View 2 Replies

DataSource Controls :: SQL Server Does Not Handle Comparison Of NText, Text / Xml Or Image Data Types

May 24, 2010

I have a bit of code in a clickevent handler like this:-

Dim products = From p In db.Products where p.product_name = "Tool" Select New With {p.Product_ID,p.Product_name}
Gridview1.Datasource = products
GridView1.Databind()

But causes error=SQL Server does not handle comparison of NText, Text, Xml, or Image data types?

where product_name field is set as type text

View 1 Replies

DataSource Controls :: Removing Duplicates From Two Similar Columns Or Any Other Columns In A Database Schema

Apr 21, 2010

I have two columns first name and last name , that have duplicates, how can i remove the duplicates and only leave the distinct members intact?

View 6 Replies

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

DataSource Controls :: Types Of Join In SQL?

Feb 25, 2010

let me know the types of joins available in SQL, so far i've used only Inner joins and left joins.

But have been clear and comfortable using inner joins only.

give me a more clear picture on all the types of joins available and their importance.

View 3 Replies

DataSource Controls :: Using Multiple Columns In A Data Relationship

Mar 4, 2010

I have two tables - dt(Mods) and dt(Mods2) - I am trying to create a relationship between them. So dt(mods) has department, category and item columns dt(mods2) has parentDept, Parentcategory and parentItems Now I need add them to a dataset with a relationship key - Something like this but with three cloumns

Dim ParentCol As New DataColumn, ChildCol As New DataColumn

View 2 Replies

DataSource Controls :: Sum Data From Two Columns In Different Tables - SQL Query

Feb 9, 2010

I am trying to create an application in which there is a summary of outstanding payments.

One table is Table_Bills.

The other table stores records of Payments made and is called Table_Payments.

In summary i want to show 3 figures - each in separate one field datagridview with a data_source in separate data_adapter:

1) Ammount_Due 2) Amount_Paid 3) Balance.

The first two are no problem but the last is giving me a headache.

I tried this:

SELECT SUM(DHB_New_Jobtable.DayWage) - SUM(DHB_Payments.Ammount) AS Expr1

View 4 Replies

DataSource Controls :: Search By First Merging The Columns Data?

Jan 16, 2010

I Have a table containing columns Address1,Address2,Address3,State,City and Area.Now i want to apply search Location where there will be a single textbox where the user can enter multiple strings seperated by spaces and then those rows should be fetched which contains all these strings entered by the user (implementing AND Case). For which the search on rows should be applied by merging the data of all the above mentioned columns and then searched.How to implement the above case?

View 12 Replies

DataSource Controls :: Object Can Not Be Cast From Dbnull To The Other Types?

May 24, 2010

I have a webpage, i have a usercontrol in it , its name ispersonal1, i have tow Radiobutton in this usercontrol, the id of one of them ismale and the other one is female, it is obviously that each time we fill one of these radiobuttons and the other one will be null,in my database the type of these fields are bit , and they have allow null, i defined a property for my usercontrol like this:

public bool male
{
get

[code]...

View 2 Replies

Forms Data Controls :: How To Get Fields Calculated Before They Get Displayed

Jul 27, 2010

I'm a college intern at a small software company. I'm a novice when it comes to ASP.net and Expression Web, so sorry if these are obvious questions.

1. After figuring out how to get fields calculated before they get displayed (did this with SQL), I need to find a way to put certain characters before the output in the fields. I'm fairly certain this is done with a template field, but I have no idea how to touch those without making them blow up.

2. I would also like to have color in the GridViews rows or cells depending on a value returned from the database. Again, I think this would be done with template fields.

3. Thirdly, I need to be able to limit the characters in a few cells. I've searched and found some answers with this, but still Template fields go right over my head.

View 7 Replies

Forms Data Controls :: Use Sorting On Calculated Column?

Dec 1, 2010

Split off from http://forums.asp.net/t/1595139.aspx:

I have an additional column called 'KPI %' in my gridview that calculates the percentage of two template fields and thus I cannot use the sortexpression on it. How can I sort the contents of the 'KPI %' column in ASC or DESC format?

View 1 Replies

Forms Data Controls :: Display Calculated Value In Gridview?

Jul 7, 2010

I have 2 amount columns (Amount and TotAmount) in my gridview. In Amount column data comes from database. I want to display the total of amounts in Amount column in my TotAmount column (So there would be just one value in TotAmount column irrespective of the number of columns in Amount column). How can I do this.

View 18 Replies

Forms Data Controls :: How To Add Calculated Fields On A Gridview

Jul 21, 2010

My gridview displays fields from a table and allows for edit, delete and insert. I need to add a column with a derived field which will be calculated every time the user is either entering a new row or editing the value of the weight field which is one of the fields of the gridview. This calculation is done in the fly and won't be saved in the database.

View 8 Replies

Web Forms :: Does Exporting DataGridView To Excel Has Limitations Of Columns Or Column Types

May 7, 2015

I am trying to export my Model to an Excel sheet. I have 31 fields out of which only 29 are exported. Among the 3 fields that I am not able to export 2 are of type Enum and one of DateTime. Their is another DateTime field also, but that is exported properly. Here are few fields of the model :

[EnumDataType(typeof(Suffix)), Display(Name = "Suffix *")]
[Required(ErrorMessage = "Suffix is Required")]
public Suffix NameSuffix { get; set; }
[EnumDataType(typeof(InquiryStatus)), Display(Name = "Status")]
[Required(ErrorMessage = "Status is Required")]

[Code] ....

Among the 4 fields above, NameSuffix, Inquiry_Status & FollowUpDate are not exported. InquiryDate is exported.

My exporting code is :

DataGrid dg = new DataGrid();
dg.DataSource = inqs.ToList<Inquiry>();
dg.DataBind();
string filename = "InquiryList_" + DateTime.Now + ".xls";
Response.ClearContent();

[Code] ....

In the ContentType, I alos tried with ""application/ms-excel";, but that makes no difference.

What can be the error for the above ?

View 1 Replies

DataSource Controls :: Update Query-datetime And Numeric Types?

Feb 17, 2010

What is syntax for query string for updating an sql datetime field and an sql number field in vb.net ?

View 1 Replies

DataSource Controls :: Deprecated Types Not Supported As Output Parameters

Jan 21, 2010

i am trying to do: Parameters.Add("@ProfileHtml", SqlDbType.Text, MAX_TEXT).Direction = ParameterDirection.Output but i keep getting this error. MAX_TEXT is integer = 2147483647 Data type 0x23 is a deprecated large object, or LOB, but is marked as output parameter. Deprecated types are not supported as output parameters. Use current large object types instead.

View 4 Replies

Forms Data Controls :: How To Sort A Gridview By A Calculated Column

May 25, 2010

Is there a way to Sort a Gridview by a Calculated Column? I have a gridview with template fields using lablels and a linq datasource. Those columns sort just fine. I can not get the Calculated column to sort, because there is no sort expression to use...

View 4 Replies

Forms Data Controls :: Calculated Fields For All Of The Rows Is Blank

Jun 22, 2010

I have a GridView bound to an ObjectDataSource. Most of the columns are directly databound, however one column is not - it's value is determined in code. The value is being calculated correctly at the RowDataBound event, however when there is more than one data row in the GridView, the calculated fields for all of the rows is blank, but the top row displays the bottom row's calculated field

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved