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
Similar Messages:
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
Oct 1, 2010
although i had to take the table that has my calculated column and make a view (so i could filter) and then bind the gridview to the view.
My question is as this.
1.) in order to get my calculated field i had to load my data into a table (as suggested)
2.)Add a column to the table and perform calculations
3.)make a dataview from the tables because i could not get the Gridview.datasource= ds.tables("loads").select("Deadhead <= " & sngRadius
4.)the largest of the 3 tables my query is based on contains about 7000 records. The way i have the logic & programming now everytime a new "truck location" is put in the textbox1 and "find loads/button1" is clicked. It calculates the deadhead miles of all 7000 records before filtering. I am filtering based on the deadhead miles.
Does anyone have any recomendation about how to speed this up a bit.
Also in order to get paging to work i had to rebind/filter the data again ... means looping through all 7000 records each time paging is called. This seems terribly ineffecient as i am already forced to use access instead of SQL.
Would i see a performance increase if i installed SQL or mySQL and create linked tables to the ones i use in access. or would access still be the bottleneck?
I don't know if the performance increase would be negligible as i still ultimately be getting the data from Access.
I have posted the entire code for the page below. When i originally started i didn't think there would be to much code so i left it all on one page instead of using code-behind. Would i gain anything by swapping to code-behind now?
[Code]....
View 2 Replies
Jun 10, 2010
from an Access database, I created an Excel spreadsheet. On the spreadsheet I made the adjustments I needed to and then proceeded to use the SQL Server 2005 Import/Export Wizard to import the spreadsheet into a SQL table. I then get the following error message:[Code]....
When I remove the problem columns from the import, then it works just fine. But I really need those text columns! The SQL Server columns that they are supposed to go into are varchar(MAX).
View 1 Replies
Oct 19, 2010
I'm using a gridview to extract a set of records. I need to add another field to the gridview, which can calculate the difference between a date associated with each record and the current date.
View 6 Replies
Jan 26, 2010
I've never used the RetrieveData() function and I don't know much about it.Having failed to work it out myself could someone show me some examples of how I call this method?Here's what I know about it:
1.It hadles the work of contacting the database and creating the DataSet.2. You must import System.Data, System.Data.SqlClient and System.Web.Configuration namespaces in teh web page.3. It can be called in any event handler in the web page code.I've tried typing this method in my page_Load() but I get the squiggly red underline which indicates that it doesn't recognise this method.
View 2 Replies
Jan 25, 2010
I want to read date field from Excel sheet and insert it into SQL Server2005.When I read date field it gives me a number say '40160' when the date feild is "08/01/2010"
How should to Read a date field from Excel Sheet Cells?
View 2 Replies
Feb 11, 2010
I'm trying to get an IDENTITY column to auto-increment with each new row inserted, so that the field (userid in this case) can be used as a unique identifier.
However, I'm getting this error:
[Code]....
My code looks like this:
[Code]....
I don't understand - if I have to explicitly insert something into my auto-increment column, how do I know what to insert? Isn't the point of an auto-increment column that it's... auto?
View 7 Replies
Jan 26, 2010
This query does not return any record
[code]....
View 3 Replies
Jan 27, 2010
I got a gridview to display the data from the database properly but when I go edit. it give me an error. I searched and change ConflictDetection=CompareAllValues to OverwriteChanges
The error goes away. However the database is still doesn't update. Does anyone had to tweak the gridview function to make it works. Maybe I did something wrong.
View 1 Replies
Feb 13, 2010
I have the following problem: I need to store in MS SQL Server 2005 a vary large text in to one field of type nvarchar(MAX), In spite of the configuration is apparently correct I keep receiving the following message in the exception: "string or binary data would be truncated".
View 1 Replies
Feb 3, 2011
I thought this would be easy but cannot now find out of to do it. All I want to do is execute an sql query on a table and in addition to the table's columns I want to also select/output a field that is calculated within the query. The table has a column "Owner" and I want to compare this to the UserId to produce a bool column "mine". Effectively doing:Select *, (Owner=@UserId) as mine where.....however, this doesn't work so how can I calculate a column in the select statement?
View 3 Replies
Dec 15, 2010
Is there a way to have a calculated column (field) in a webGrid in webMatrix?
View 4 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
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
Apr 25, 2010
how can i use cursor in this function ?
ALTER FUNCTION [dbo].[GetCatIDChilds]
(
@CatID [code].....
View 1 Replies
Mar 3, 2010
I wanna join all the field as a new col.
but how can i ignore the empty field because i always join the field and separate by space like the following.
select (field_1+' '+field_2+' '+field_3) as new_col from TABLEA
but if the field is empty, then there is the double space
how can i ensure all the space is one space only.
View 2 Replies
Apr 7, 2010
I have a 20 to 30 fields on a form. Most of them are optional. However, the users can fill out what they want. If a user dosen't fill in a field when data is sent to the database it's sent as blank, instead of NULL. Is there a way I can generically say "for all textboxes if Equals("") then DBNull.Value". Without going through each and every textbox?
View 2 Replies
Sep 3, 2010
I have defined a field validator that works fine on normal behavior on a page:
<asp:RequiredFieldValidator runat="server" ErrorMessage="errroooorr" ControlToValidate="TextBoxHouseNumber" Display="Dynamic"></asp:RequiredFieldValidator>
Now if I dont insert any text in the TextBoxHouseNumber field, and push submit, the FieldValidator fires as it should. But if I now click a button that automatically fills the TextBoxHouseNumber with text from a Jquery/Ajax function, the field validator still shows. Itīs like "Hey, the user hasnt made any changes to the textbox, so I wont bother check it".
View 6 Replies
Apr 28, 2010
How to query a SQL database with 3 field values ( From date, To date and based on a Dropdown Selection)
I use the below code:
sqls = "SELECT * FROM QlyData where Date >='" + txtstartdate.Text +
"' and Date<='" + txtenddate.Text +
"' and '" + supportgrp.Text +
"'";
Supportgrp.text is a Dropdown selection.I get the below error:
Exception Details: System.Data.SqlClient.SqlException: An expression of non-boolean type specified in a context where a condition is expected, near 'Database'.
View 2 Replies
Feb 3, 2010
i had the sql 2008 enterprise and i want to go back to sql server 2005 because in 2008 i created new database but when i did some changes in the table , it gave me an eror that i cant save thins and i need to creat new one if some one know what i'm talking aboutif not i need the sql server installation tutorial i tried by myself but probebly i did it wrong and now i cant connect well to the sql
View 2 Replies
Feb 3, 2010
Can I call a javascript function from a hyperlink field in gridview?I dont want to navigate to a different page,instead i need to call the javascript on clicking the hyperlink.
View 3 Replies
Oct 18, 2010
i have a form with a gridview that does the edits. I have a detailsview that does the inserts. If I test the run the form using default values as parameters the form wors fine. If I use a the hyperlinked field as below to go to the form the form does not work.It
[Code]....
View 9 Replies
Jul 22, 2010
The pages on my project are base on master and content pages...
I want to do something with javascript(rather than jquery) in one of content pages after ALL OF MASTER AND CONTENT ELEMENTS ARE LOADED COMPLETELY.(for example set focus on a RadComboBox Control)
For doing that I used the below code :
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script src="../JQuery/jquery-1.4.1.js" language="javascript" type="text/javascript"></script>
<script type="text/javascript"> [code]...
But alert(combo); always returns null.(the $find code is for telerik controls and the upper codes about telerik controls are completely true)To solve this null problem I test the ways shown below:
1-I Removed all of controls from master and content page except RadComboBox Control and null problem disappeared , so i derived the null peoblem is about all of elements of master and content page have not been loaded when
$find("<%= RadcbPersonelCompleteNameInvwNoskhehEdit.ClientID %>"); is fired.
2-so i used $(document).ready(function() { my codes }); instead of onload = onloadOfDocument;
3-at last i test the below code and it works perfectly :
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script src="../JQuery/jquery-1.4.1.js" language="javascript" type="text/javascript"></script> [code]...
What function of document should i use for doing some javascript codes after all Of MASTER AND CONTENT ELEMENTS are loaded completely?
View 1 Replies
Mar 18, 2010
in sql 2008 .mdf file detached and attached db in sql 2005.
View 1 Replies