.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Sharon Maxwell
Post New Web Links

problem in date format in sql 2005

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :ASP.Net
 
I am new to sql2005  My problem is,  I send a date parameter (@fdt  and @Tdt)   like "DD/MM/YYYY" format through Sql reporting services My query is select  * from deposits where Depdate >= @fdt and Depdate <=  @tdt in the aove query there is no record has been fetched   But i give like this,  Inthis case i get a resultselect  * from deposits where Depdate >= '2010/04/01' and Depdate <= '2010/08/31' pls tell me how can i convert the date to "yyyy/mm/dd"    in where condition   Thanks Gk  


View Complete Post


More Related Resource Links

date format problem

  

I require a date formatted as "dd/mm/yyyy" regardless of culture, and have tried the following with the current date.

The current date is 18/10/2010 i.e. 18th October 2010.
Both of the following formatting attempts end up with a result of "18/00/2010", not  "18/10/2010" as expected i.e. the month is being set to "00", not '10" as it should be.

Why is this happening? it is driving me crazy.

Dim DateString as string
DateString = Date.Today.ToString("dd/mm/yyyy")
DateString = String.Format("{0:dd/mm/yyyy}", Date.Today)

Thanks


DATE TIME PROBLEM IN C SHARP USING SQL 2005

  

how to get the date only 
not the date and time value 

i use the following method but it fail !! 

select * from HourWorksheet where date(date ad sdate)=" + EntryDate.value.Date +"" 
and im using another method like this
"select ID,Date from HourWorksheet where Date=CONVERT(VARCHAR(30),'" + EntryDate.Text + "',103) and ID=1"




Problem in Date Format While Exporting To Excel Destination From Flat File Source In SSIS

  

Hi,

I have a flat file(.csv) which contains data(strings incuding date in yyyy-mm-dd format).This i am using in Flat File Source and want to export those data to an Excel Destination.Before exporting to Excel Destination i have created a Derived Column component where i am using an express to get day,month,year part and creating a date sting in dd/mm/yyyy format then conveting it to DT_DATE datatype and then exporting to Excel Component.But while exporting to Excel this date format is getting changed to mm/dd/yyyy format.

The expression i used in derived column is

(DT_DATE)(SUBSTRING(date,9,2) + "/" + SUBSTRING(date,6,2) + "/" + SUBSTRING(date,1,4))

where date is a column from Flat File Source.

Even I changed the Locale to English(United Kingdom) in Flat File Connection Manager for the above .csv file.But still it didnt work.

I searched a lot in google and failed to get any solution on this.

Can anyone help me in solving this issue ?


How To Set a Date Format In GridView Using ASP.NET 2.0

  
A very common desire is to set a column of a gridview to display just the month, day and year of a DateTime type. The problem is the by default, the HtmlEncode property of the boundfield attribute (
The problem is that if this field is enabled, you can not pass format information to the boundfield control. That is, if you try the following code, you will not get the desired result.

How to format datetime & date with century?

  
Execute the following Microsoft SQL Server T-SQL datetime, date and time formatting scripts in Management Studio Query Editor to demonstrate the usage of the multitude of temporal data formats available and the application of date / datetime functions.

http://www.sqlusa.com/bestpractices2005/centurydateformat/

How to convert Date format from dd/MM/yyyy to mm/dd/yyyy in asp.net

  

Hi,

         I am using a text box which captures the date from the datepicker and displays in dd/MM/yyyy format in asp.net using C#

When i try to pass this text box value into the DatTime variable i am getting the error as

"String was not recognized as a valid DateTime. "

 

my code goes like this

DateTime dt;

dt=DateTime.Parse(TextBox1.Text);

Response.Write(dt);

 

i tried to use Conver.ToDateTime() function but the same error is croping up..

 

Can any one plz suggest me on this.....Thnks in advance


Problem when installing Microsoft SQL Server 2005 Reporting Services Add-in for Microsoft SharePoint

  
Hi,

I have configured the SharePoint Production Server(Standalone) with WS 2008 64 bit version, SQL Server 2005 with SP3 , Visual Studio 2008 and MOSS 2007(SP3). I have configured SSRS 2005 in SharePoint integration mode. Everything works fine till the last step. Now, i am trying to install Microsoft SQL Server 2005 Reporting Services Add-in for Microsoft SharePoint Technologies feature and failed. I am getting below error message.

Product: Microsoft SQL Server 2005 Reporting Services Add-in for Microsoft SharePoint Technologies -- You must first install SharePoint Server before installing SQL Server 2005 Reporting Services Add-in for SharePoint Technologies



Any help will be very appreciated!

Thanks,
-Raj

Report printing problem(ssrs 2005)

  
HI   i have a SSRS 2005 report with width as 32 inches i have a requirement to print the report in a3 landscape  but when i print the report it comes in 3 page width   is there any way to auto scale the report into a3 size without affecting the view in the report viewer   Thanks varun kumar

SQL 2005 Database Problem

  
When trying open up a report from a customer database.  I recieved the following error: Please contact technical support with the following information:   Error ID: ERHIG030000340 Error message: There was a problem with the SQL or table when trying to open the display The table name is "taOrderHistory" The SQL is: Underlying problem: Column 'taOrderHistory.OrderHistoryID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) at RadWebNet.rwDataSupport.OpenData(String SQLIn, rwConnection ConnIn, OpenDSReturnType ReturnWhat, Int32 TimeOut, Object[] ParamsIn) in D:\Misc Projects\RadWeb\RadwebV4-7-1\rwData.v

Insert DATE to database (format 'YYYY-MM-DD')

  
How can I insert BIRTHDATE into column in 'YYYY-MM-DD' format. This is my code, can anyone edit my code? Tnx String = "INSERT into concfile VALUES(BIRTHDATE('" & DateTimePicker1.Text & "', 'YYYY-MM-DD'))"

DataContractJsonSerializer: Problem when deserializing the Date

  
Sorry for cross-posting. I posted the same question on the Silverlight forum, but it has not received a single answer yet. The majority of folks there must be more interested in UI than in more fundamental stuff.     Hello everyone! Let's say we have the folllowing POCO classes: public class PocoObject : List<PocoPropertyData> {     public PocoObject() {}     public override string ToString()     {         var parts = new List<string>();         foreach (var pd in this)             parts.Add(string.Format("{{N=[{0}], Type=[{1}], V=[{2}]}}", pd.N, pd.V == null ? typeof(object) : pd.V.GetType(),  pd.V));         return string.Join(",", parts);     } } public class PocoPropertyData {     public string N { get; set; }  // the property name     public object V { get; set; }  // the property value } As you can see, the PocoPropertyData can hold value of any type. When I execute the following code in both .NET 4 application and Silverlight 4 application: ========================================================= var poco = new PocoObject {       { new PocoPropertyData { N = "DateTimeField", V =  Da

how can I make field with date in format: dd/mm/yyyy ?

  
I have in model:[DisplayName("Publication date")] [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)] [Required(ErrorMessage = "Publication date is required.")] public DateTime publication_date { get; set; } And in view:<div> <%: Html.LabelFor(model => model.publication_date) %> </div> <div> <%: Html.TextBoxFor(model => model.publication_date, new { @class = "datepicker" })%> <%: Html.ValidationMessageFor(model => model.publication_date) %> </div> But when I write in this field date: 30/11/2009 I see validation error: The value '30/11/2009' is not valid for publication_date.

Problem to install MS SQL 2005 on Window 7 Operating System

  
Hi, I recently have problem to install MS SQL 2005 on Window 7 Operating System. Setup showing an error for compitability issues. When click on to button to check for solution online, after a while it pop up that No solutions found for Microsoft SQL Server 2005. Any one know solution for this? Is is possible to install Microsoft SQL Server 2008 on Window 7 and migrate data from Microsoft SQL Server 2005 to 2008? Please advice. Appreciate your help. Thanks.

Problem Integration SQL Reporting Service 2005 and SharePoint 2007

  
Hello, I'm trying to make our SQL Reports available on our SharePoint report center. I have SQL 2005 (sp3) report server that resides on a different server than our SharePoint 2007 server. So in our SRS Configuration Tool, we changed the database mode for SharePoint integration (before, we only had it in native mode), so we created a new database for this SharePoint Integration type. Next, I installed the Report Server Add-in for SharePoint 2007 server and it was successful. However when configuring the Report Server, we got stuck at the step "Grant Database Access". For some reason we keep getting error message "Named instance not found" We already installed Service Pack 3 on the Report Server... I heard that the problem is because the mismatched version between the Report Server Add-in in SharePoint and the SQL RS version... but I don't think this is the case for us. Do we need to install WSS on our Report Server too?     Another question: We already integrate our Report Server with Microsoft Dynamics CRM 4.0. However I see that when the Report Server is in the SharePoint Integration mode, all the reports in CRM don't work (because Report Manager is no longer available in this mode). Do you think it would be the best practice to install a copy of Report Server instance in our SharePoint 2007 server? Thank you, greatly appreciate all your hel

Problem Integration SQL Reporting Service 2005 and SharePoint 2007

  
Hello, I'm trying to make our SQL Reports available on our SharePoint report center. I have SQL 2005 (sp3) report server that resides on a different server than our SharePoint 2007 server. So in our SRS Configuration Tool, we changed the database mode for SharePoint integration (before, we only had it in native mode), so we created a new database for this SharePoint Integration type. Next, I installed the Report Server Add-in for SharePoint 2007 server and it was successful. However when configuring the Report Server, we got stuck at the step "Grant Database Access". For some reason we keep getting error message "Named instance not found" We already installed Service Pack 3 on the Report Server... I heard that the problem is because the mismatched version between the Report Server Add-in in SharePoint and the SQL RS version... but I don't think this is the case for us. Do we need to install WSS on our Report Server too?     Another question: We already integrate our Report Server with Microsoft Dynamics CRM 4.0. However I see that when the Report Server is in the SharePoint Integration mode, all the reports in CRM don't work (because Report Manager is no longer available in this mode). Do you think it would be the best practice to install a copy of Report Server instance in our SharePoint 2007 server? Thank you, greatly appreciate all your hel

Problem casting date

  
I'm developing a Windows Forms app using VS 2008 with a SQL Server 2005 database. I've got search form where users can search for data by entering one or two criteria. One of these is a date which corresponds to a date field in my database. The user clicks on a button, which feeds the criteria into a stored procedure. The results are displayed in a datagridview control. While the functionality works well with the non-date criteria, whenever a date criteria is used on it's own a cast error is raised ('Conversion failed when converting datetime from character string.') I've tried lots of ways of casting the date (formatting using left, right and mid finctions, using the substring function etc) but still can't get it to work. Code and SQL are shown below. Does someone know where I've gone wrong? 'DateAssayRequested' is the date in question. <vb> 'set up and initialise connection conn = New SqlConnection(etc) comm = New SqlCommand comm.Connection = conn comm.CommandText = "SPSearch" comm.CommandType = CommandType.StoredProcedure 'create input parameters, set types and values param = comm.CreateParameter param.ParameterName = "@assayid" param.Direction = ParameterDirection.Input param.Value = txtLabNo.Text

Date validation problem modelstate.isvalid is false

  
In my view i am formatting the date as follows<%= Html.TextBox("MemoDate", string.Format("{0:dd/MM/yyyy hh:mm}", DateTime.Now),new{ @readonly = true })%> In controller ModelState.IsValid become false as my current culture culture {en-US} doesn't match with the format of date.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend