Aritmetic Overflor On READING A Date Value

Mar 19, 2004

I have a date in my SQL Server Database of 3/12/2204. This is, of course, 200 years after today and is not a correct value.





However, when my repeater is trying to display the records in that table, I get the following error:





"Arithmetic overflow error converting expression to data type datetime."





Here is the stack trace:





[SqlException: Arithmetic overflow error converting expression to data type datetime.]


System.Data.SqlClient.SqlDataReader.Read() +157


System.Data.Common.DbEnumerator.MoveNext() +44


System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +504


System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +48


System.Web.UI.WebControls.Repeater.DataBind() +23








Now, none if this is in my own code, and so it is difficult to put any decent error-trapping. This is all in the built-in ASP.NET Repeater and SqlDataReader classes.





Why on Earth would there be an arithmetic overflow here? Note that the original table this is coming from has the date stored in the SqlDbType.DateTime format! In other words, why is there any conversion needed?





Perhaps it is converting the data from SqlDbType to DbType, but even then, what is so difficult about dealing with the year 2204? According to BOL, the DateTime data type should support up to the year 9999!





Note that when I access the table through Enterprise Manager and change the date, the error disappears. I tried a number of over-and-under tests, and I get this error on any date after 3/19/2151!





Does ASP.NET not support dates after that? I doubt it, but does anyone have an explanation for this?





Thanks,


JK

View 2 Replies


ADVERTISEMENT

Are There Any Built In Aritmetic Capabilities On The 'Date And Time' Type?

Mar 6, 2006

Simply put, I have a 'Date and Time', (06/03/2006 11:40:00), passed to the SelectCommand via the QueryString. I would like to gain data that is between the supplied time and 1 hour prior.Is there a simple way to take 1 hr off the 'Date and Time" value or is it necessary to build code that parses the string then adjusts it?
The 'Time' and 'TimeStamp' entities below are both of type 'Date and Time' and all values are gained from the same sql database. I.e. the time used as the basis for selecting the hr period is from the same database as the one where the hour period will be selected from.
Any help would be great.
 
SelectCommand="SELECT [Timestamp], [Volume] FROM [out8$] WHERE (([CustomerLvl1] = @CustomerLvl1) AND ([Timestamp] = @Timestamp))">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="TNT Express" Name="CustomerLvl1" QueryStringField="Cust"
Type="String" />
<asp:QueryStringParameter DefaultValue="20/02/2006 22:20:00" Name="Timestamp" QueryStringField="Time"
Type="DateTime" />

View 2 Replies View Related

How To Get Latest Temperature Reading For Each Date In A Date Range

Sep 28, 2012

I have to display the last temperature reading from an activity table for all the dates in a selected date range.So if I select the date range from 09/01/2012 to 09/30/2012, the results should look like this:

Date Temperature
09/01/2012 73.5
09/02/2012 75.2
09/03/2012 76.3
09/04/2012 73.3
09/05/2012 77.0
09/06/2012 74.5
and so on.

I am using this to get the dates listed:
WITH CTE_DatesTable
AS
(
SELECT CAST('20120901' as date) AS [Date]
UNION ALL
SELECT DATEADD(dd, 1, [Date])
FROM CTE_DatesTable
WHERE DATEADD(dd, 1, [Date]) <= '20120930'
)
SELECT [Date]
FROM CTE_DatesTable

How could I get the temperature if I did a sub-query here?

View 5 Replies View Related

Reading Data From Navision To SQL Server: Date Issues

Jul 23, 2005

Hi:I'm trying to read data from Navision 2.60 ERP with own database to aSQL Server 2000 database via ODBC. All is working except just onething, how to filter data with a date field.I have some big tables that have a date field and I just want to readdata from one or few days, not all the table, cos I will be doing thisevery day (datawarehousing).If I write in my SQL Server DTS:SELECT *FROM MYNAVISIONTABLEWHERE (MYDATE = { d '2005-06-30' })It works! This notation is the one required by C/ODBC Navision driver.Now I want to change 2005-06-30 for something like "sysdate" or "today"or similar... to execute this all days.... any ideas?THANK YOU,RegardsFran

View 2 Replies View Related

How To Use Convert Date Statement In CmdInsert.Parameters.Add(Date,SqlDbType.DateTime).Value = Date

Sep 21, 2006

HiI am using SQL 2005, VB 2005I am trying to insert a record using parameters using the following code as per MotLey suggestion and it works finestring insertSQL; insertSQL = "INSERT INTO Issue(ProjectID, TypeofEntryID, PriorityID ,Title, Area) VALUES (@ProjectID, @TypeofEntryID, @PriorityID ,@Title, @Area)"; cmdInsert SqlCommand; cmdInsert=new SqlCommand(insertSQL,conn); cmdInsert.Parameters.Add("@ProjectID",SqlDbType.Varchar).Value=ProjectID.Text; My query is how to detail with dates my previous code wasinsertSQL += "convert(datetime,'" + DateTime.Now.ToString("dd/MM/yy") + "',3), '";I tried the code below but the record doesn't save?string date = DateTime.Now.ToString("dd/MM/yy"); insertSQL = "INSERT INTO WorkFlow(IssueID, TaskID, TaskDone, Date ,StaffID) VALUES (@IDIssue, @IDTask, @TaskDone, convert(DateTime,@Date,3),@IDStaff)"; cmdInsert.Parameters.Add("IDIssue", SqlDbType.Int).Value = IDIssue.ToString();cmdInsert.Parameters.Add("IDTask",SqlDbType.Int).Value = IDTask.Text;cmdInsert.Parameters.Add("TaskDone",SqlDbType.VarChar).Value = TaskDoneTxtbox.Text;cmdInsert.Parameters.Add("Date",SqlDbType.DateTime).Value = date;cmdInsert.Parameters.Add("IDStaff",SqlDbType.Int).Value = IDStaff.Text;Could someone point to me in the right direction?Thanks in advance

View 3 Replies View Related

Reading An Excel Doc

Jul 16, 2007

hi guys, Can anyone advise me how how to read an excel doc i have stored locally? I need to be able to start the read from say row number 6 and finish the read once i get to a row that contains a pre-determined  word signifying the end of processing. I intend to store the parsed data in an array that will be used as the data source for a gridview or repeater object on another asp page. I'm using ASP.net 2.0 and C# by the way. thanks in advance for any help!!! 

View 12 Replies View Related

DataReader Not Reading

Jan 13, 2004

Why won't this dataReader read?

Dim objCon2 As New SqlConnection()
objCon2.ConnectionString = "a standard connection string"
objCon2.Open()

Dim objCommand As SqlCommand
objCommand = New SqlCommand(strSQL, objCon2)
Dim objReader As SqlDataReader
objReader = objCommand.ExecuteReader()

Label1.Text = objReader("email")

strSQL is a select command which I've checked (using SQL Query analyzer) does return data. I know the connection string is valid (and I presume if it wasn't that it'd fail on objCon2.open, which it doesn't).

So why oh why do I get this error on the last line (and yes, there is an "email" field in the contents of the reader)

System.InvalidOperationException: Invalid attempt to read when no data is present.

View 1 Replies View Related

Help With Reading Database.

Jun 29, 2005

I have this code that I hacked together from someone else's example.  I kind of understand how it works.  I just don't know if it will and i am not in a location right now to check.  I was wondering if I did this correctly first, second how can it improve and should i do something different.  Basically i just want to check the password in a database. I am passing the username and password to this function from another functioprivate bool authUser(string UserName, string Password){ string connectionString = ConfigurationSettings.AppSettings["DBConnectionString"];  SqlConnection DBConnection = new SqlConnection(connectionString);  bool result = false;  DBConnection.open() SqlCommand checkCommand = new SqlCommand("SELECT password FROM Users WHERE userName='" + Password + "', DBConnection) SqlDataReader checkDataReader = checkCommand.ExecuteReader();
 if(checkDataReader.GetString(0) == Password) {  result = true; } else {  result = false; } checkDataReader.Close(); DBConnection.Close();
 return result;}Thank you Buddy Lindsey

View 6 Replies View Related

Reading Transaction Log

May 30, 2001

Does anyone know how to read transaction log besides trace and profiler. The current situation is some one in our org. deleted an item and I'm trying to find out who and when.

View 2 Replies View Related

Reading Log File

Feb 9, 2000

I have some records that have been deleted. I need to find out who did it and to do that I need to read the logs. Are there any utilities that will allow me to read login 7.0? How about 6.5?

Chris

View 2 Replies View Related

Reading The Transaction Log In SQL 7.0

Dec 22, 1999

Here is I think an interesting question
is there a way to read or access the transaction log of a
database in SQL server 7.0

Hoping someone has a solution :-)

View 5 Replies View Related

Reading The Transaction Log

Nov 2, 1999

We are having continual problems with our transaction log filling up on one of our major applications.
Does anyone know of a way or tool to read the transaction log? We want to determine what is causing this problem.

Thanks

View 3 Replies View Related

Reading The Transaction Log

Jul 12, 1999

Is there a way, in SQL 7.0 to print out or view what's in the Transaction Log? In 6.5 you could view the table syslogs, but I don't see any documentation anywhere on how to do this in 7.0.

View 1 Replies View Related

Reading Xml In A Sql Table

Apr 8, 2005

I receive in a table a field which is an xml string
like below

<NewOrder><SiteID>CJC</SiteID><patID>458887</patID><LName>Cronin</LName><FName>tim</FName><EntryID>{7B1A4946-CEC8-4F23-AE89-5C70A6A0F9B2}</NewOrder>

Is there a way read this field with a select statement? I need to strip out the entryid value in a trigger

View 4 Replies View Related

Reading SQL 6.5 Databases

Aug 23, 2001

I received a SQL Server 6.5 database (.dat file) on a removeable drive. I'm currently running 7.0. Is there any way to read/import/link to this data without installing 6.5. And if I have to install 6.5 how do I get the system to see the database?

View 1 Replies View Related

Reading MS-SQL Transaction Log

May 24, 2002

Hello people;


Somebody knows some utility where I can read the Transaction Log Sql 2000 ?

Thanks;


Navlig®

View 1 Replies View Related

Reading A Ini File In DTS

Jun 10, 2002

Hi

How can I read an ini file entry and pass this parameter to a stored procedure which will be run in a DTS Package?


Thanks for the input

mipo

View 2 Replies View Related

Reading DTS Packages

Sep 19, 2001

Anyone know a way to read DTS packages? I have inherited a DTS package, saved in SQL, and am trying to find a way to read the steps without having to view every single step through the GUI.

Thanks in advance.

View 3 Replies View Related

Reading ClientProcessID

Sep 1, 2006

Hi,

I need to know that how can we read ClientProcessID (älso use used in SQL Profiler).

Regards,
Shabber.

View 2 Replies View Related

Reading Results Into .NET

May 20, 2008

Hi. I want to write a function to retrieve all records from a "Parts" table so that I can read these records in .NET.

SqlDataReader reader = sqlCmd.ExecuteReader()

while( reader.Read() )
{
int x = reader["id"];
string partName = reader["name"];

// Do stuff with data here //
}


My question: How should the function be written?

Should I create a PROCEDURE and just call a SELECT statement?

CREATE PROCEDURE getPartsList()
AS
SELECT part_id as 'id', part_name as 'name' FROM parts


Or should I create a FUNCTION that returns a TABLE? If so, is this the correct syntax?

CREATE FUNCTION getPartsList()
RETURNS TABLE
AS
RETURN (SELECT part_id as 'id', part_name as 'name' FROM parts)


Thanks for reading

View 3 Replies View Related

Reading XML Element

Jun 9, 2014

The requirement is to read XML element from database column.The column looks like

<ClMetadataDataContract xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.cch.com/pfx.net/psi/">
<EntityType>1</EntityType>
<NameLine1>David Jones</NameLine1>

[code]....

I have also tries OPENXML but no luck

View 2 Replies View Related

Reading Log File

Jun 22, 2008

How do I view the SQL 2005 transaction log file(.ldf)?

Is there a built-in utility?

Thank you

View 3 Replies View Related

Reading A File

Jun 24, 2008

I am storing one text file on the server.This text file contains some mobile numbers.The file look like
009198XXXXXXXX
009198XXXXXXXX
009198XXXXXXXX
009198XXXXXXXX
etc

Here I need to read this text file row by row mobile number and then insert these mobile numbers into a table by using sql procedure or sql trigger or any other method or coding. Is it is possible or not?
If so then anybody can help me!

regards
Shaji

View 4 Replies View Related

Reading ID From XML File???

Jul 13, 2006

Hello friends...

We have sql server 2000 and i need to read one perticular xml and from that i want ID field stored in one table...is it possible by query analyzer to read xml and stored ID in table...I have only path of that xml file...



like



select ID from ("D:XMLFolder*.xml)



that i want

View 2 Replies View Related

SP Is Not Reading The Table Name?

Aug 23, 2006

-- drop proc SP_Trio_Popul_Stg_Tbls1
CREATE PROC [dbo].[SP_Trio_Popul_Stg_Tbls1] @tableName varchar(20) AS
-- alter PROC [dbo].[SP_Trio_Popul_Stg_Tbls1] @tableName varchar(20) AS


declare @sql varchar (20)

set @sql = 'INSERT INTO dbo.Name_Pharse_Stg_Tbl1 (nm_last)
SELECT nm_name FROM dbo.' + quotename(@tableName)

print @sql
exec (@sql)

----------------------------------------------------------------------
exec SP_Trio_Popul_Stg_Tbls1 '00485'
----------------------------------------------------------------------
INSERT INTO dbo.Name
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'Name'.


im trying to run this SP but im getting an error. Can you help me to fix it?

-------------------------
gongxia649
-------------------------

View 20 Replies View Related

Reading From A Xl Sheet

Jul 17, 2007

Hi All,

I would like to know if i can read data from xl sheet using a stored procedure?

Thanks in advance

vishu

View 17 Replies View Related

Recommend Some Reading

Jul 25, 2007

Hi,
I've been a developer for 20 some years, but never learned the design steps of a complex database. Can you give me a book or 2 to bring me up to speed with the latest database design and data modeling techniques?

thanks.....

View 3 Replies View Related

Reading A Directory

Feb 28, 2007

I do a lot of file processing and I usually run a little script I copyand paste to read directory information to see if a new file it thereand then process the file if it is. So, I decided to wise up and makea stored procedure to automate a lot of that.The pivotal step in this is that i run a command that looks like:CREATE TABLE #DIR (FileName varchar(100))DECLARE @Cmd varchar(1050)SET@Cmd = 'DIR "' + @Path + CASE WHEN RIGHT(@Path, 1) = '' THEN ''ELSE '' END + @WildCard + '"'INSERT INTO #DIREXEC master..xp_CmdShell @CmdWhen I run the stored procedure I get back the files and folders inthere that match the wildcard and all is good!!!!....Until I try to put that information into a table while calling thatstored procedure:CREATE TABLE #Files (Path varchar(100),FileName varchar(100),PathAndFileName varchar(150),FileDateTime SmallDateTime,FileLength int,FileType Varchar(10))INSERT INTO #FilesEXEC sp_GetFileNames @Path = '\isoft2ftpLegacyBilling', @Wildcard= '*.txt'When I run this I get:Server: Msg 8164, Level 16, State 1, Procedure sp_GetFileNames, Line53An INSERT EXEC statement cannot be nested.Because I use an INSERT EXEC to with the results from the @Cmd.Anybody have any ideas how I can get that information into a table?I did try to just copy the data to c: empdir.txt and then bulkimport it in. But when it runs the @Cmd to create the file it comesback with a NULL value and my stored procedure returns two sets ofvalues... which I can't do.So, I would appreciate anybody who can help.Thanks!-utah

View 4 Replies View Related

Reading Transaction Log.

Jul 20, 2005

Hi,How can i read information in Transaction Log in SQL Server 2000?Thanks

View 1 Replies View Related

Reading SQL Data

Jul 6, 2005

I posted this in the Windows Forms Data Binding section, and they directed me to the .Net data section.  I posted it there and waited a week with no replies.  I'm hoping someone here can at least give me an idea of what the problem might be.

View 1 Replies View Related

Reading In An XML File From A URL

Oct 17, 2006

Hi

I have a problem with SSIS in that I need to read an XML file in from a URL,which brings me back the below XML. What I need to be able to do is essentially create a single record, including the nested XML <image> into the same record. This information then needs to be entered into a database table.

What I found is that if I use a data flow component, and have an XML source pointing to this URL, it essentially creates a different output for every level of nesting. This causes me serious issues because I would then have to somehow get to the information in the <image> tag, and then get everything below that, etc, to be able to get the images related to each <stock> record. This is a pain.

I also looked at using an XML task, where I could use an XSLT to transform to the required output, however, I can't point this XML task to a URL to retrieve the XML.

If anyone has any ideas I would greatly appreciate it

Thanks

Darrell



XML Format

------------------

<feed date="2006-10-17 17:08:46">

<usedstock>

<stock id="SFU22991">

<make>Peugeot</make>

<model>206</model>

<description>Peugeot 206 1.4 X-Line, 5 door Hatchback Tiptronic Auto 4Spd</description>

<hotline>08451553610</hotline>

<spec>Air Conditioning, Power Steering, Central Locking, Electric Windows, Alloy Wheels, CD Player</spec>

<deepurl>http://www.regvardy.com/used_car/dseller/SFU22991</deepurl>

<search>http://www.regvardy.com/used_cars/dseller/Peugeot/206</search>

<regdate>2005-01-27</regdate>

<colour>Blue</colour>

<price>7495</price>

<stocktype>USED</stocktype>

<category>Small</category>

<transmission>Tiptronic Auto 4Spd</transmission>

<bodystyle>Hatchback</bodystyle>

<fueltype>Petrol</fueltype>

<type>NCV</type>

<doors>5</doors>

<engine>PE0BC</engine>

<capcode>PE2614SED5HPIA</capcode>

<capid>26440</capid>

<image>

<urls>

<url>http://www.regvardy.com/imagedata/vehicles/g/pj54lyg_1.jpg</url>

<url>http://www.regvardy.com/imagedata/vehicles/g/pj54lyg_2.jpg</url>

<url>http://www.regvardy.com/imagedata/vehicles/g/pj54lyg_3.jpg</url>

</urls>

<libraryimage/>

</image>

</stock>

</usedstock>

</feed>

View 4 Replies View Related

How To Reading Clusters ?

Sep 20, 2006

Hi,

For our trainign data clustering models show the maximum accuracy.

We want to preset the results to our client. In order to do that we want to present what are the properties of each cluster.

For example for my predictable attribute if Cluster 9 is showing maximum population then I want to show what conditions of attributes make cluster 9 .

What is the way of doing this ?

Thanks,

Vkas

View 3 Replies View Related

ASP.NET: Reading A CSV File With C#

Jan 22, 2008

I am trying to read from a datasource that is a CSV file using C#, but for some reason I keep getting an error that says:

System.Exception: System.Data.OleDb.OleDbException: Syntax error in FROM clause.

My code looks like this:


String sql = " SELECT IDnumber FROM report.csv WHERE username = @Username ";



ArrayList parameters = new ArrayList();

parameters.Add(new OleDbParameter("@Username", Username));

DataTable dt = OleDbUtility.getDataTable(sql, parameters, OleDbUtility.GetCNetIDConnectionString());


It worked with an Excel file, so any ideas on this one?
It seems like the connection string is fine...

View 6 Replies View Related







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