Error In Viewing Datetime Value In Gridview Itemtemplate

May 9, 2008

Hi!



I am trying to show the StartTime and the EndTime in one column.



Start - End

9:00:00 - 10:00:00



I tried the following code, but it is returning an error.




<asp:TemplateField HeaderText="Start - End">

<ItemTemplate>

<asp:Literal ID="litTimeRange" runat="server" Text='<%# Eval("timeRange") %>'>

</asp:Literal>

</ItemTemplate>

</asp:TemplateField>



<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ScheduleConnectionString %>"

SelectCommand="SELECT ID, ([StartTime]+ ' - ' + [EndTime]) as timeRange, CompanyName, Purpose, AccountManager, Presenter, ColorCode, Status, Comments FROM Demo_Theatre_DB WHERE (StartTime &gt;= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (StartTime &lt;= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1))">

</asp:SqlDataSource>





The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.



[SqlException (0x80131904): The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.]

System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +925466

System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800118

System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186

System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet
bulkCopyHandler, TdsParserStateObject stateObj) +1932

System.Data.SqlClient.SqlDataReader.HasMoreRows() +150

System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) +212

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

System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping) +153

System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +153

System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) +170

System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +175

System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137

System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83

System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770

System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17

System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149

System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70

System.Web.UI.WebControls.GridView.DataBind() +4

System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82

System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69

System.Web.UI.Control.EnsureChildControls() +87

System.Web.UI.Control.PreRenderRecursiveInternal() +50

System.Web.UI.Control.PreRenderRecursiveInternal() +170

System.Web.UI.Control.PreRenderRecursiveInternal() +170

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041




Your will be appreciated.



Thanks!

View 3 Replies


ADVERTISEMENT

[:#] Problems Viewing The Custom Sql Statement In The Gridview Control

Jul 28, 2007

Hi,
 I really need some help trying to figure out why my gridview is not working when I create a custom sql statement. It "executes" the query, but gives me an error message when I "test the query". Here is the error message: "There was an error executing the query. Please check the syntax of the command and if present, the types and values of the parameters and ensure they are correct. Syntax error: Expecting '.', identifier or quoted identifier."
Here is my sql statement:
SELECT     TBLPROJECTS.NAME, TBLPROJECTTYPES.NAME AS PROJECTTYPE, TBLPROJECTS.DESCRIPTION, TBLUSERS_1.LOGIN AS OWNERNAME,                       TBLUSERS.LOGIN AS MANAGERNAME, TBLPROJECTS.START_DATE, TBLPROJECTS.END_DATE, TBLAOI.NAME AS AREAOFINTEREST,                       TBLPROJECTS.MANPOWER, TBLUNITS.NAME AS MANPOWERUNITFROM         TBLPROJECTS INNER JOIN                      TBLAOI ON TBLPROJECTS.AOI_ID = TBLAOI.ID INNER JOIN                      TBLPROJECTTYPES ON TBLPROJECTS.PROJECTTYPE_ID = TBLPROJECTTYPES.ID INNER JOIN                      TBLUNITS ON TBLPROJECTS.MANPOWERUNITS_ID = TBLUNITS.ID INNER JOIN                      TBLUSERS ON TBLPROJECTS.MANAGER_ID = TBLUSERS.ID INNER JOIN                      TBLUSERS TBLUSERS_1 ON TBLPROJECTS.OWNER_ID = TBLUSERS_1.ID
I have tested it on a new project and still it does not work, I cannot find any problem, please help!!!!!!!!!!!!!!!!!!!!!!!!
 

View 5 Replies View Related

Want Error Message To Appear When No Database Results Were Returned In GridView, Also Other GridView Issues.

Jun 12, 2008

Hi, I am seeking a hopefully easy solution to spit back an error message when a user receives no results from a SQL server db with no results. My code looks like this What is in bold is the relevant subroutine for this problem I'm having.   Partial Class collegedb_Default Inherits System.Web.UI.Page Protected Sub submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submit.Click SqlDataSource1.SelectCommand = "SELECT * FROM [college_db] WHERE [name] like '%" & textbox1.Text & "%'" SqlDataSource1.DataBind() If (SqlDataSource1 = System.DBNull) Then no_match.Text = "Your search returned no results, try looking manually." End If End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load SqlDataSource1.SelectCommand = "SELECT * FROM [college_db] ORDER BY [name]" SqlDataSource1.DataBind() End Sub Protected Sub reset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles reset.Click SqlDataSource1.SelectCommand = "SELECT * FROM [college_db] ORDER BY [name]" SqlDataSource1.DataBind() End SubEnd Class  I'm probably doing this completely wrong, I'm a .net newb. Any help would be appreciated. Basically I have GridView spitting out info from a db upon Page Load, but i also have a search bar above that. The search function works, but when it returns nothing, I want an error message to be displayed. I have a label setup called "no_match" but I'm getting compiler errors. Also, next to the submit button, I also have another button (Protected sub reset) that I was hoping to be able to return all results back on the page, similar to if a user is just loading the page fresh. I'd think that my logic would be OK, by just repeating the source code from page_load, but that doens't work.The button just does nothing. One final question, unrelated. After I set this default.aspx page up, sorting by number on the bottom of gridview, ie. 1,2,3,4, etc, worked fine. But now that paging feature, as long with the sorting headers, don't work! I do notice on the status bar in the browser, that I receive an error that says, "error on page...and it referers to javascript:_doPostBack('GridView1, etc etc)...I have no clue why this happened. Any help would be appreciated, thanks! 

View 2 Replies View Related

Format The Datetime In GridView

Apr 6, 2007

On displaying data in the gridview with sqldatasource in asp.net C# 2005 on the datetime datatype field i want to display only the date but it displays the time also on each and every row.

On the money datatype field i want to display the roundoff amount or with decimal upto 2places like 12,000.00 which is shown as 12,000.0000...
I have seen the same question in previous topic also but don't got it so asking in my post...

Pls tell me some format to avoid this invalid data.

Thanxs in advance and waiting for ur response.

View 3 Replies View Related

Error While Viewing All Rows Through EM

Oct 4, 2006

hello..

i am getting strange error while opening design through EM..when i tried to open it i m getting error like..

Action Canceled
Internet explorer was unable to link to the web page you requested....

why this error i am getting...also i am unable to view all rows through EM... :(

T.I.A

View 3 Replies View Related

Report Viewing Error

Apr 9, 2008

Hi,

I have deployed the Reports created in the dev server to another server say ABCD. I am able to view the Report manager of ABCD from the dev server and also the projects under it. Also I can see the list of reports in it. But when I am trying to view any report it gives me an error saying "Your Browser does not support scripts or has been configured not to allow scripts". Has any one of you come across similar kind of problem? Has this anything to do with the browser settings or with the report server settings?

Thanks in advance

View 2 Replies View Related

Error When Viewing A Microsoft SQL DTS

Jul 2, 2007

I am trying to view the design of a DTS on a Microsoft SQL 2000 database but get the below error:



Error: Data Transformation Services (DTS) Package

Error: The system cannot find the file specified.





What could be the issue. Im an using Enterprise manager from a 2000 instalation.

View 8 Replies View Related

Error Viewing Reports

Mar 21, 2007

I have created a report, in SQL RS 2000, using My Windows Credentials.

ie under the datasource tab, I chose the "credentials stored securely in report server" OPTION. There I specified my user NT Credentials.

However, when I view the report, it gives me err

An error has occurred during report processing. (rsProcessingAborted) Get Online Help

Cannot create a connection to data source xxx. (rsErrorOpeningConnection) Get Online Help

Login failed for user xxxx
Pl advise.
Thanks.

View 1 Replies View Related

Error Viewing Reports

Aug 8, 2007

Hi everybody,
first i am having problem viewing the reports, when i go to http://localhost/ReportServer/ i get a list of files and folders as follow:
[To Parent Directory]

01 يوليو, 2007 11:14 ص <dir> bin
06 سبتمبر, 2005 01:12 ص 488278 Catalog.sql


06 سبتمبر, 2005 01:12 ص 14738 CatalogTempDB.sql04 يوليو, 2007 05:26 م 76 global.asax 04 يوليو, 2007 05:38 م 10540 rsreportserver.config
13 يونيو, 2005 02:07 م 11845 rssrvpolicy.config
01 يوليو, 2007 11:14 ص <dir> Styles
08 اغسطس, 2007 09:58 ص 2776 web.config
and when i try to open any folder it shows its content, then i select any report and click on it, it gives me the following error:An internal error occurred on the report server. See the error log for more details. (rsInternalError) Invalid object name 'ReportServerTempDB.dbo.PersistedStream'.could anyone help me please?? thanks in advance....

View 1 Replies View Related

Error Viewing The Execution Option Of A Report

Jun 10, 2005

I select the option execution from a report (it's in properties option) and then raise an error which says An internal error occurred on the report server. See the error log for more details. (rsInternalError) Get Online Help EXECUTE permission denied on object 'xp_sqlagent_notify', database 'mssqlsystemresource', schema 'sys'.

View 29 Replies View Related

Can Anyone Spot My Error Please Binding A Gridview

Jan 21, 2008

Hi All
I am trying to bind a gridview to my sql express database through code but my data is not being displayed, i dont get any errors though?
If i bind it using an sql datasource it works fine so i know my connection string works and there is data in my database
my code is as follows
thanks
gibbo
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
ReadRecords(GridView1, "Select * from Actions")
End Sub

Public Shared Function GetConnString() As String
Return System.Configuration.ConfigurationManager.ConnectionStrings("actionsConnectionString2").ConnectionString
End Function

Private Sub ReadRecords(ByVal datagrid As GridView, ByVal SQL As String)
Dim ConnString As String = GetConnString()
Dim SqlString As String = SQL
Using conn As New SqlClient.SqlConnection(ConnString)
Using cmd As New SqlClient.SqlCommand(SqlString, conn)
cmd.CommandType = CommandType.Text
conn.Open()
Using reader As SqlClient.SqlDataReader = cmd.ExecuteReader()
datagrid.DataSource = reader
datagrid.DataBind()
End Using
End Using
End Using
End Sub


Connection String

<add name="actionsConnectionString2" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=&quot;|DataDirectory|actions.mdf&quot;;Integrated Security=True;Connect Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />
 

View 8 Replies View Related

Error While Using Database Procedure In A Gridview Control

Dec 19, 2006

Dear Forum,
I have a gridview control  which is associated to a storedprocedure  with a parameter(Customer Number) to be supplied.  In the Define Custom Statement or stored procedure section  I selected stored procedure and selected the stored procedure.  The Define Parameter window I defaulted the Parameter Source as 'none' and default value as '%'.   In the next screen, I do a test query which retuns the following error
There was an error executing the query.  Please check the syntax of the command and if present, the type and values of the parameters  and ensure that they are correct.
[Error 42000] [Microsoft][ODBC SQL Server Drive][SQL Server] Procedure 'SP_TransactionDetails' expects parameter '@cnum' which was not supplied.
I am using SQL server studio  2005 version2.0. 
But the same procedure, if I use as SQL Statement, it works.
Can somebody help me.
Thanks,
Hidayath 

View 3 Replies View Related

Error While Viewing Reports Unable To Locate Control SSRS 2005: OReportCell

Apr 30, 2007

Hello Friends,
I have created few reports in SSRS 2005 on Windows 2003 Standard. Previouly I was not able to view reports from my .ASPX page which contained a ReportViewer, after going throuhg some other threads I was able to create a snap-shot for my reports . But still I'm not able to view reports, each time I try to view the page I get a message box with a error as : "Unable to locate control SSRS 2005: oReportCell" the same error is displayed when i try to access my reports from "http://localhost/reports.....".
But the funny thing is I'm able to view the reports when I use the following URL: "http://localhost/reportserver/pages/reportviewer.aspx?/<report>". I have applied all the Hotfixes & installed the latest Service packs. Any suggestions ???????

View 1 Replies View Related

Error Editing Data Records In Gridview When Using Convert Function.

Jan 24, 2008

Hello, i currently have a gridview that is populated with data from a SQLServer datasource. I have put an output mask in the select statement, so the date and time attributes are displayed in the format i prefer them to be in. SELECT PatientNo, ConsultantName, HospitalName, CONVERT (varchar, Date, 101), CONVERT (varchar, Time, 8) FROM [Appointment];
 However when i click the 'edit' link for a record in the gridview, i am unable to edit the date/time attributes and when i click update to confirm any changes to the other attributes, the values in the date/time attributes are emptied. How can i solve this update problem. I'm guessing i need to configure my SQL UPDATE statement, but bit stuck how i do this. Please help!
Thanks,
James

View 9 Replies View Related

Error Viewing Report Created In Report Builder

Nov 24, 2006

Using the report builder, I created a simple report based on a report model. This report runs ok in the report builder.

I proceeded to save the report to the report server, but when I want to view this report in Report Manager, I get the following error:

An error has occurred during report processing.

Query execution failed for data set 'dataSet'.

Incorrect syntax near '<'. The label 'xmlns' has already been declared. Label names must be unique within a query batch or stored procedure. The label 'xmlns' has already been declared. Label names must be unique within a query batch or stored procedure. The label 'xmlns' has already been declared. Label names must be unique within a query batch or stored procedure. The label 'xsi' has already been declared. Label names must be unique within a query batch or stored procedure. The label 'xsi' has already been declared. Label names must be unique within a query batch or stored procedure. The label 'xsi' has already been declared. Label names must be unique within a query batch or stored procedure.

View 6 Replies View Related

ERROR:Syntax Error Converting Datetime From Character String. With Stored Procedure

Jul 12, 2007

Hi All,





i have migrated a DTS package wherein it consists of SQL task.

this has been migrated succesfully. but when i execute the package, i am getting the error with Excute SQL task which consists of Store Procedure excution.



But the SP can executed in the client server. can any body help in this regard.





Thanks in advance,

Anand

View 4 Replies View Related

Error 241: Syntax Error Converting Datetime From Character String

Jan 7, 2004

Hi All, can someone help me,
i've created a stored procedure to make a report by calling it from a website.
I get the message error "241: Syntax error converting datetime from character string" all the time, i tryed some converting things but nothig works, probably it is me that isn't working but i hope someone can help me.
The code i use is:


CREATE proc CP_Cashbox @mID varchar,@startdate datetime,@enddate datetime
as
set dateformat dmy
go
declare @startdate as varchar
declare @enddate as varchar

--print "query aan het uitvoeren"

select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = '@mID' and njdate between '@startdate' and '@enddate'
GO



Thanx in front
Cya

View 14 Replies View Related

Getting Error : : The Conversion Of A Char Data Type To A Datetime Data Type Resulted In An Out-of-range Datetime Value

Jan 28, 2008

update tblPact_2008_0307 set student_dob = '30/01/1996' where student_rcnumber = 1830when entering update date in format such as ddmmyyyyi know the sql query date format entered should be in mmddyyyy formatis there any way to change the date format entered to ddmmyyyy in sql query?

View 5 Replies View Related

Gridview / SqlDataSource Error - Procedure Or Function &<stored Procedure Name&> Has Too Many Arguments Specified.

Jan 19, 2007

Can someone help me with this issue? I am trying to update a record using a sp. The db table has an identity column. I seem to have set up everything correctly for Gridview and SqlDataSource but have no clue where my additional, phanton arguments are being generated. If I specify a custom statement rather than the stored procedure  in the Data Source configuration wizard I have no problem. But if I use a stored procedure I keep getting the error "Procedure or function <sp name> has too many arguments specified." But thing is, I didn't specify too many parameters, I specified exactly the number of parameters there are. I read through some posts and saw that the gridview datakey fields are automatically passed as parameters, but when I eliminate the ID parameter from the sp, from the SqlDataSource parameters list, or from both (ID is the datakey field for the gridview) and pray that .net somehow knows which record to update -- I still get the error. I'd like a simple solution, please, as I'm really new to this. What is wrong with this picture? Thank you very much for any light you can shed on this.

View 9 Replies View Related

Datetime Error

Feb 2, 2004

while executing the following statement:
select convert(datetime,'Nov 31, 2002 10:05pm')
got the following error:
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

the datetime set is mdy
is there any way to make this work though this is not according to the iso standarts.

regards,
harsh.

View 2 Replies View Related

Datetime Error In SQL

Apr 25, 2008

Hi,
I need a help!!! I am trying to convert string to datetime and i dont know how to...
when i run my stored procedure I got an error message:
Server: Msg 242, Level 16, State 3, Line 45
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

part of my stored procedure that gives me an error message is:

case when b.ClaimStatusCode <> 3
then cc.BenefitEndDate
else NULL end, '00-00-0000' as MaxBenefitDate

So when ClaimStatusCode is NOT closed (claimstatuscode <>3) is going to show cc.BenefitEndDate...but if claim is closed (claimstatuscode = 3) then its going to show '00/00/0000' on the crystal report.

or maybe someone know how to write a formula in crystal report to be able to do this.

Please help!!!! Thank you so much!!!!

~WT

View 11 Replies View Related

Datetime Error

Oct 15, 2007

declare @table table(c1 int,c2 datetime)


insert into @table (c1,c2) values(1,'14/01/2007')

when i execute this the following error appears:

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
The statement has been terminated.

View 5 Replies View Related

DateTime Error

May 14, 2006

I have a function that is based aounr the input of parameters. The last remaing issue is that I am required to enter the data into the parameter field as mm/dd/yyyy. I want to be able to enter the data as dd/mm/yyyy. I have tried to use

WHERE (CONVERT(datetime,src_terrier.datadate,103) = @dt_src_date) AND..........

But this just throws an error "Msg 8114, Level 16, State 1, Procedure spWTRalldatareportsummary, Line 0
Error converting data type nvarchar to datetime."

The execution line I am using is

USE [DashboardSQL-2K5]
GO

DECLARE @return_value int

EXEC @return_value = [dbo].[spWTRalldatareportsummary]
@dt_src_date = N'28/04/2006',
@chr_div = NULL,
@vch_portfolio_no = NULL,
@vch_prop_cat = NULL

SELECT 'Return Value' = @return_value

GO
Anybody got any ideas as to what I have done wrong? I have also tried it without the N just before the date and get a varchar version of the same error.

Thanks in advance

View 5 Replies View Related

Datetime Conversion Error?

Jan 17, 2008

 Hi,
I am getting the following error when
executing the ExecuteInsert in the code below..:
 
Conversion failed when converting
datetime from character string.



    private bool
ExecuteInsert(String quantity)   
{[snip]       
con.Open();       
SqlCommand command = new SqlCommand();       
command.Connection = con;       
TextBox TextBox1 =
(TextBox)FormView1.FindControl("TextBox1");       
Label 1 = (Label)FormView1.FindControl("Label3");       
Label 2 = (Label)FormView1.FindControl("Label13");       
command.CommandText = "INSERT INTO Transactions (etc,Date,etc)
VALUES (etc,@date,@etc)";        
command.Parameters.AddWithValue([snip]);       
command.Parameters.AddWithValue([snip]);        command.Parameters.AddWithValue("@date",
DateTime.Now.ToString());        
command.Parameters.AddWithValue([snip]);       
command.Parameters.AddWithValue([snip]);       
command.ExecuteNonQuery();       
con.Close();       
command.Dispose();       
return true;    }    protected
void Button2_Click(object sender, EventArgs e)   
{        TextBox TextBox1 =
FormView1.FindControl("TextBox1") as TextBox;       
bool retVal = ExecuteUpdate(Int32.Parse(TextBox1.Text));       
if (retVal)           
Response.Redirect("~/URL/EXTENSION.aspx");       
Insert();    }    private
void Insert()    {       
TextBox TextBox1 = FormView1.FindControl("TextBox1") as
TextBox;       
ExecuteInsert(TextBox1.Text);    }}  Thanks if someone can help!Jon

View 2 Replies View Related

Datetime Overflow Error

Feb 26, 1999

When doing a DATEDIFF on two dates, I get the error:

Msg 535, Level 16, State 0
Difference of two datetime fields caused overflow at runtime.

I have tracked the error down to a field in a couple of records out of several thousand records.

I don't know how to fix it the problem. BOL describes the error as a field having the wrong datatype that both datatypes are DATETIME.

Running: SQL Server 6.5 with SP4.

Any help is appreciated because we are going into code freeze this afternoon and going live next week.

TIA,
Virginia

View 1 Replies View Related

Error Using CONVERT(DATETIME,....

Dec 9, 2005

I have a stored procedure that takes a @INPUT_DATE Varchar(25) as an input parameter. It passes this @Date to a User Defined function that checks if @Date is a valid date and then returns either the date or a "1" for not a valid date. If it is not a valid date, I use the RAISERROR and stop the insert call.

Here is the parts from the Stored Procedure


Code:

--Input Parameter
@INPUT_DATEvarchar(25) = NULL,

--Send the Parameter to the User Defined Function
DECLARE @Error AS INT
DECLARE @ErrorMessage AS VARCHAR(200)


--Check to make sure a all dates are entered correctly
SET @INPUT_DATE = dbo.Function_Check_Date(@INPUT_DATE)

IF (@INPUT_DATE = '1')
BEGIN
SET @Error = 1
SET @ErrorMessage = '-Date formatted wrong'
RAISERROR(@ErrorMessage, 15, 1)
END
-------------------------------------------------------

IF @Error <> 1
BEGIN
INSERT INTO Table1(DateColumn)
VALUES (CONVERT(DATETIME, @INPUT_DATE))



And here is my User Defined Function


Code:

CREATE FUNCTION [dbo].[Function_Check_Date]
(
@Temp VarChar(25)
)
RETURNS VARCHAR

AS

BEGIN
DECLARE @Date VarChar(25)

IF (ISDATE(@Temp) = 0) AND (@Temp <> 'N/A') AND (@Temp <> '')
BEGIN
SET @Date = '1'
END
ELSE IF (@Temp = 'N/A') OR (@Temp = '') --For not availables or Blanks
BEGIN
SET @Date = CONVERT(DATETIME, '1/1/1900')
END

ELSE
BEGIN
SET @Date = CONVERT(DATETIME, @Temp)
END

RETURN @Date

END






The error is occuring when I try to convert the @INPUT_DATE to a datetime in the insert statement. The field value for the DateColumn in the database is a DateTime format. The error I receive is Error Converting datetime from character string. But when I test all these items in Query Analyzer, I am able to do each step without error?

Thanks for any advice, as I am rather confused.

View 5 Replies View Related

Convertion Datetime Error

Jan 29, 2008

i am getting error while convering datetime datatype using

convert(x,101)
function

Arithmetic overflow error converting expression to data type datetime

please help me

View 11 Replies View Related

Error With Datetime Datatype

Oct 31, 2006

Hi Guys,

I'm having problem in loading textfile into the database. One of the columns in the textfile has a datetime datatype.

Here is a sample of the text file. All the other columns are string except for the datetime: "5/4/2006"

"1","1","ITEM","5/4/2006","10:05:04","11110",10004,"Regular Half Chicken",1,130.00,0,0


Error is shown below.

Error: 0xC0202009 at Data Flow Task, OLE DB Destination [154]: An OLE DB error has occurred. Error code: 0x80004005.

An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Invalid character value for cast specification".

Error: 0xC020901C at Data Flow Task, OLE DB Destination [154]: There was an error with input column "Transaction_Date" (1233) on input "OLE DB Destination Input" (167). The column status returned was: "The value could not be converted because of a potential loss of data.".

Error: 0xC0209029 at Data Flow Task, OLE DB Destination [154]: The "input "OLE DB Destination Input" (167)" failed because error code 0xC0209077 occurred, and the error row disposition on "input "OLE DB Destination Input" (167)" specifies failure on error. An error occurred on the specified object of the specified component.

Error: 0xC0047022 at Data Flow Task, DTS.Pipeline: The ProcessInput method on component "OLE DB Destination" (154) failed with error code 0xC0209029. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.

Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: Thread "WorkThread0" has exited with error code 0xC0209029.



Please help!!!

Thanks in advance,

Larry

View 7 Replies View Related

Error In Datetime Conversion

May 21, 2008

Hi everyone,

I have a problem with a datetime field.
In the database is stored as datetime (121 format) ex. 2008-05-20 17:30:00.000
I have a simple select query (no datetime conversions used) and the result I get from the report looks like 5/20/2008 5:30 PM.

I dont want this format so i use this custom dd:MM:yyyy hh:mms

After that i get the dates like this 5/20/2008 5:30 instead of 17:30.

Any suggestions appreciated...



View 1 Replies View Related

Default Datetime Error

Mar 21, 2007

hi friends,

i have two datetime parameters in my report ... based on these parameters , am searching records ... the issue is i cant get the full datetime value

for example

i am searching records based on 03/16/2007 and 03/20/2007... i can't the records for the date 03/20/2007...

bcoz, the value of the date is '03/20/2007 00:00:00.000'

i want to get the value like this ' 03/20/2007 11:59:59 pm''

can any one help me

View 6 Replies View Related

Error Sql Excpetion Datetime.now Could Not Be Bound..

Apr 7, 2008

I am trying to call a userdefined function and it excepts and date like 4/15/2007 but when i call my function i get an error

the multipart identifier datetime,now could not be bound
and this is my codePublic Function GetPeriods()
Dim myconnection As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings(APPSETTING_DBCONNECTION))
Dim query1 As String = "Select dbo.udf_Quarter(Datetime.Now)" 'Max(PeriodId) From Period"
myconnection.Open()
Dim MaxPeriodId As Integer
Dim cmd As New SqlCommand(query1, myconnection)
cmd.CommandType = CommandType.Text
MaxPeriodId = cmd.ExecuteScalar()
Response.Write(MaxPeriodId)
Session("PeriodId") = MaxPeriodId

Return (MaxPeriodId)

End Function any help will be appreicated
Regards,
Karen

View 2 Replies View Related

Error In Query--datetime Related

May 21, 2008

Hi y'all I have a problem in my query.This is my querySELECT     dbo.BOS_GL_Workplace.WpszState, Emp2.szName, Emp1.szName AS szEmpName, Emp1.szEmployeeId,                     dbo.BOS_PI_Division.szName AS Divisi, dbo.BOS_PI_Team.szDescription,dbo.BOS_SD_Route.szRouteId, dbo.BOS_SD_Route.szDescription, dbo.BOS_SD_Route.szScheduleId,                    dbo.BOS_SD_RouteItem.szCustId, dbo.BOS_SD_Route.szOpUserId,dbo.BOS_AR_Customer.szCustId ,dbo.BOS_AR_Customer.szName, dbo.BOS_AR_Customer.CustszAddress_1 AS AlamatKirim, dbo.BOS_AR_Customer.szTaxId,                     dbo.BOS_AR_Customer.CustszAddress_1 AS AlamatTagih, dbo.BOS_AR_Customer.CustszCity, dbo.BOS_AR_Customer.CustszZipCode,                     dbo.BOS_AR_Customer.szStatus, dbo.BOS_AR_CustSales.szPaymentTermId, dbo.BOS_AR_CustSales.decCreditLimit,BOS_AR_Customer.dtmStart,BOS_AR_Customer.dtmLastUpdated                    FROM         dbo.BOS_PI_Employee Emp1 LEFT OUTER JOIN                    BOS_PI_Employee Emp2 on Emp1.szSupervisorID = Emp2.szEmployeeID Left outer join                     dbo.BOS_GL_Workplace ON Emp1.szWorkplaceId = dbo.BOS_GL_Workplace.szWorkplaceId LEFT OUTER JOIN                     dbo.BOS_PI_Division ON Emp1.szDivisionId = dbo.BOS_PI_Division.szDivisionId LEFT OUTER JOIN                     dbo.BOS_PI_Team ON Emp1.szTeamId = dbo.BOS_PI_Team.szTeamId LEFT OUTER JOIN                     BOS_SD_Route on Emp1.szEmployeeId = BOS_SD_route.szOPuserId LEFT OUTER JOIN                    BOS_SD_RouteItem on BOS_SD_Route.szRouteId = BOS_SD_RouteItem.szRouteID LEFT OUTER JOIN                    BOS_AR_Customer on BOS_SD_RouteItem.szCustID = BOS_AR_Customer.szCUstID LEFT OUTER JOIN                    BOS_AR_CustSales on BOS_AR_Customer .szCustId = BOS_AR_CustSales.szCustID When I run that query, it was working fine the result was correct. Then I tried to add the where clause, like this:WHERE BOS_AR_Customer.dtmLastUpdated >= '8/1/2006' AND BOS_AR_Customer.dtmLastUpdated <='9/21/2007'And it was also working fine, the result was also correct--pay attention dudes the date format is mm/dd/yyyyThen I try to change the date format to dd/mm/yyyy in the where clause like this (because later I realized that, this is the query that gonna be used):WHERE BOS_AR_Customer.dtmLastUpdated >= '1/8/2006' AND BOS_AR_Customer.dtmLastUpdated <='21/9/2007'The result was an error message saying:"The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value."Can you tell me whats wrong, please. I appreciate anykinds of help guys, thanks. FYI : I use SQL SERVER 2000 Best Regards.  

View 1 Replies View Related

Error Converting Datetime To String.

Jun 6, 2008

I have a dropdown list thats boudn to a SqlDataSource.  The DataSource looks like this:
  <asp:SqlDataSource ID="dsProgramList" runat="server" ConnectionString="<%$ ConnectionStrings:csData %>"
SelectCommand="SELECT DISTINCT [Program_Name] +','+ [Begin_Date] AS NAMEandDATE, [Course_ID], [LOC] FROM [ThisTable] WHERE ([LOC] = @LOC)">
<SelectParameters> 
 
Where the dropdownlists text = NAMEandDATE and its value = Course_ID
When I select the LOC from the LOCdropdownlist, the dropdownlist in question updates, and an error "Erro converting datetime from character string" happens?
Any suggestions?

View 4 Replies View Related







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