Max Of Date Field In Query
I have a table with date field
e.g.
SrNo Date
1 1-MAR-2008
2 3-Mar-2008
3 7-Mar-2008
4 10-Mar-2008
5 15-Mar-2008
I need a query to find out Max date which is less than '8-Mar-2008' .
i.e i need single output '7-Mar-2008'
anybody help
Thanks
View Complete Forum Thread with Replies
Related Forum Messages:
How To Format A Date Field In Select Query
Is it possible to format the date field create_date (mm/dd/yyyy or mm/dd/yy) I use the following query in stored proc. will be called in the asp.net page for population the datagrid. select id, name, create_date from actionstable; Please help, Thank you.
View Replies !
Help Needed For Date Field (Age) Calculation In SQl Query
Hi experts,I am working on SQL server 2005 reporting services and i am getting aproblem in writting a query.Situation is given below.There is one table in database Named ChildNow i have to find the All childrens whoes Age is 13 years Base onSome given parameter.If User select Augus 2007 then It has to calculate the Childs who bornin August 1994 And if he select September Then queryshould show only those child Who born in September 1994 and soon..... And use can select another year month also likeAugust 2009 ...I am writting the following querySelect Child_Name, DOb from Childwhere ((CONVERT(DateTime, A.Date_Of_Birth, 103) >= @ Parameter1And (CONVERT(DateTime, A.Date_Of_Birth, 103) <= @Parameter2)If i know already month and year then i can write easily parameter1and parameter2 But since these are comming from user so i m notfinding how to handle this.Now please suggest me what i have to write in Where statement I thinka lot but not getting any idea about it.Any help wil be appriciated.RegardsDinesh
View Replies !
Pass In Null/blank Value In The Date Field Or Declare The Field As String And Convert
I need to pass in null/blank value in the date field or declare the field as string and convert date back to string. I tried the 2nd option but I am having trouble converting the two digits of the recordset (rs_get_msp_info(2), 1, 2))) into a four digit yr. But it will only the yr in two digits. The mfg_start_date is delcared as a string variable mfg_start_date = CStr(CDate(Mid(rs_get_msp_info(2), 3, 2) & "/" & Mid(rs_get_msp_info(2), 5, 2) & "/" & Mid(rs_get_msp_info(2), 1, 2))) option 1 I will have to declare the mfg_start_date as date but I need to send in a blank value for this variable in the stored procedure. It won't accept a null or blank value. With refresh_shipping_sched .ActiveConnection = CurrentProject.Connection .CommandText = "spRefresh_shipping_sched" .CommandType = adCmdStoredProc .Parameters.Append .CreateParameter("ret_val", adInteger, adParamReturnValue) .Parameters.Append .CreateParameter("@option", adInteger, adParamInput, 4, update_option) .Parameters.Append .CreateParameter("@mfg_ord_num", adChar, adParamInput, mfg_ord_num_length, "") .Parameters.Append .CreateParameter("@mfg_start_date", adChar, adParamInput, 10, "") Set rs_refresh_shipping_sched = .Execute End Please help
View Replies !
Informix Date Type Field To SQL Server Datetime Field Error
I am trying to drag data from Informix to Sql Server. When I kick off the package using an OLE DB Source and a SQL Server Destination, I get DT_DBDATE to DT_DBTIMESTAMP errors on two fields from Informix which are date data ....no timestamp part I tried a couple of things: Created a view of the Informix table where I cast the date fields as datetime year to fraction(5), which failed. Altered the view to convert the date fields to char(10) with the hopes that SQL Server would implicitly cast them as datetime but it failed. What options do I have that will work?
View Replies !
Create Date Field From Substring Of Text Field
I am trying to populate a field in a SQL table based on the valuesreturned from using substring on a text field.Example:Field Name = RecNumField Value = 024071023The 7th and 8th character of this number is the year. I am able toget those digits by saying substring(recnum,7,2) and I get '02'. Nowwhat I need to do is determine if this is >= 50 then concatenate a'19' to the front of it or if it is less that '50' concatenate a '20'.This particular example should return '2002'. Then I want to take theresult of this and populate a field called TaxYear.Any help would be greatly apprecaietd.Mark
View Replies !
How Do I Convert A Unix Date/Time Field To A Date When The The SQL DB Stores That Data As Char 11?
Hi there. I'm trying to extract data from my SQL server & everything in the script I've got is working (extracting correct data) except for one field - which is for the most part it's off by +2 days (on a few occasions - I see it off by just +1 day or even +3, but it's usually the +2 days). I'm told that it's due to the conversion formula - but - since SQL is not my native language, I'm at a bit of a loss. The DB table has the date field stored as a type: CHAR (as opposed to 'DATE') Can anyone out there help? Please advise. Thanks. Best. K7
View Replies !
Insert Date Into Column Based On Date Field
Hi, I need to insert into a column (lets say column x) a date based on the date on another column (lets say column y). What I need is: Take the day and month from column x (all records are formated yyyy-mm-dd) Place it in column y The yyyy in column y should be - currenct year +1 and no the year in column x. All help welcome.
View Replies !
Problem With Current Date For Date & Time Field
I have a table named "shift" and I need to setup my query to return only data where the field "startime" = today. The problem I am running into is the starttime field it laid out like "2005-12-29 14:00:00" with different time values. I need to ruturn everything that has todays date regardless of the time value. I tried using GetDate() but that is returning data for other days as well or just data before or after the current time. Does anyone have any suggestions? This is driving me crazy! Thanks, Garrett
View Replies !
Compare Date Field To Text Field
Hi, I am very new to using SQL. Our department usually uses Brio to query the various databases under our control. However, I have recently come against a problem that prompted me to create a custom SQL query which works well as far as it goes. My problem is looking for specific conditions in billing information I receive monthly. I would like to compare on of the date fields contained in the database with a field in the form of YYYYMM (200710, for October 2007) I have created a custom column generator that forms a date from the YYYYMM. I would like, however, do the translation on the fly and make the comparison during the query. The problem is that query without the date check returns a mass of data, only about 1 percent of which is what I want. The beginning of the SQL query looks like this: FROM From.T_Crs_Tran_Dtl WHERE T_Crs_Tran_Dtl.Crs_Bill_Yr_Mo IN ('200710', '200711', '200712') AND ((T_Crs_Tran_Dtl.Crs_Cde IN ('1G', '1V') AND (T_Crs_Tran_Dtl.Dptr_Dte < LastDay(ToDate(Substr ( Crs_Bill_Yr_Mo, 5, 2 )& "/1/"&Substr ( Crs_Bill_Yr_Mo, 1, 4 )))) AND (T_Crs_Tran_Dtl.Prev_Stats_Cde IN (' ', 'TK', 'TL') AND T_Crs_Tran_Dtl.Cur_Stats_Cde IN ('TK', 'TL') AND T_Crs_Tran_Dtl.Std_Tran_Typ_Cde='B') OR (T_Crs_Tran_Dtl.Prev_Stats_Cde='UN' AND T_Crs_Tran_Dtl.Cur_Stats_Cde='XX' AND€¦ It is the €œ(T_Crs_Tran_Dtl.Dptr_Dte < LastDay(ToDate(Substr ( Crs_Bill_Yr_Mo, 5, 2 )& "/1/"&Substr ( Crs_Bill_Yr_Mo, 1, 4 )))) AND€? part of the query that is just plain wrong. The business part of this statement takes the YYYYMM field and turns it into a date which is the last day of YYYYMM. I hope someone out there can help me with making this comparison. I appreciate your help. Bill
View Replies !
Comparing Today's Date With Date In Field
I want to be able to compare today's date with the date that is in the database. Right now I have: Select Field1, Field2 FROM table 1 Where Year(TS_Date)=Year('3/1/2006')and Month(TS_Date)=Month('3/1/2006') Where I have to change the date every month. Is there a way to use GetDate or another type of code so it could automatically update every month. Any suggestions would be very greatful.
View Replies !
SUM If Date Field &&>=inputted Field?
I need help. I'm one step short of getting what I need. Here is what I have: SELECT FilteredIncident.accountidname, FilteredIncident.ticketnumber, FilteredIncident.createdon, FilteredIncident.modifiedon, FilteredIncident.new_enduserfirstname, FilteredIncident.new_enduserlastname, FilteredIncident.responsiblecontactidname, FilteredIncident.statuscodename, FilteredIncident.title, SUM(FilteredActivityPointer.actualdurationminutes) AS TotalTime FROM FilteredActivityPointer LEFT OUTER JOIN FilteredIncident ON FilteredIncident.incidentid = FilteredActivityPointer.regardingobjectid GROUP BY FilteredIncident.accountidname, FilteredIncident.ticketnumber, FilteredIncident.createdon, FilteredIncident.modifiedon, FilteredIncident.new_enduserfirstname, FilteredIncident.new_enduserlastname, FilteredIncident.responsiblecontactidname, FilteredIncident.statuscodename, FilteredIncident.title HAVING (FilteredIncident.accountidname = @accountid) AND ((FilteredActivityPointer.actualstart >= @billtime) OR (FilteredIncident.statuscodename <> N'Problem Solved')) This pulls everything that started after a certain date (@billtime) AND everything that is not closed. This is what I want; however, I need the SUM(FilteredActivityPointer.actualdurationminutes) AS TotalTime to only calculate the TotalTime after the @billtime regardless of the status. I can easily code in the date in the format 03/04/2008 but I haven't figured out how to do it successfully. I tried an IIF within the SUM and just got a syntax error (I'm assuming it is because FilteredActivityPointer.actualstart is a date/time.) Essentially, I need a report that shows all open tickets in the system AND all tickets that have been worked on since a specific date regardless of status that only totals the time spent during that date range. Many thanks to anyone who can help.
View Replies !
Updating Database Date Field Results In Date Value Of &"01/01/1900&"
Brand new to this, so please bear with me.I'm using the following code fragment to update a datetime field on a SQL Server 2005 database table:cmd.CommandText = "Update Projects Set EntryDate = " & Convert.ToDateTime(txtEntryDate.Text)cmd.ExecuteNonQuery()The result of the update operation is the the database field contains the value "1900-01-01 00:00:00:000". This probably means that I passed nulls to SQL; however, I see a valid date in the txtEntryDate field on my web form (i.e., "06/18/2007"). I also did a "Response.write" to display the txtEntryDate and it looks Okay.Can someone tell me what I'm doing wrong?Thanks!Using Visual Web Developer 2005 Express.
View Replies !
Date Field
I have a database table that contains a date field. I don't know how to construct an sql query that returns the record that has the next closest date (in the future) to the actual date. I know I need to brush up on sql but any help would be greatly appreciated. Thanks Ramila
View Replies !
Date Field
I have a date field that I imported as a varchar (as there were Null values) - anyway, the dates are in European format as well as in American format 12/24/00 24/12/00 Is there a query I can run to make all the entries in the field be listeed in US Format? Also, I suspect that the Server is reading 00 as 1900 - not sure but a 'Select * from employee where TstartDate > 01/02/00' returns all values ie 02/12/97 and all the rest. Can anyone help? Thanks in advance, Anthony
View Replies !
Date Field Using T-sql
hi friends i wish to set a date data type to a column "Date". when i use datetime format, the values is inserted in the U.S. date & time format. i want the values to be in the british english format. i.e dd/mm/yyyy only and does not require time value. can any one help me to insert the date values in the british english format regards.., sekar.
View Replies !
Date Field
Ho do you set the date field in an SQL SERVER table. I only want to show just the date without time in my col. Isnt there a DATE type for SQL table. I have a big problem with dates as I have imported all my datas from Access MDB. Tnx
View Replies !
MS SQL - Date Field?
I have set my record rsAge to a datetime and set default value to (getdate()) I want to fill in a date of birth, when i try this with something like 08/11/78 it just comes back with: 01/01/1900 00:00:00
View Replies !
Query Help - Giving A Date Range Given The Start Date, Thanks!
Hi Group!I am struggling with a problem of giving a date range given the startdate.Here is my example, I would need to get all the accounts opened betweeneach month end and the first 5 days of the next month. For example, inthe table created below, I would need accounts opened between'5/31/2005' and '6/05/2005'. And my query is not working. Can anyonehelp me out? Thanks a lot!create table a(person_id int,account int,open_date smalldatetime)insert into a values(1,100001,'5/31/2005')insert into a values(1,200001,'5/31/2005')insert into a values(2,100002,'6/02/2005')insert into a values(3,100003,'6/02/2005')insert into a values(4,100004,'4/30/2004')insert into a values(4,200002,'4/30/2004')--my query--Select *[color=blue]>From a[/color]Where open_date between '5/31/2005' and ('5/31/2005'+5)
View Replies !
Date Field Problem
I have a SQLselect command such as ; Dim komut As String = "Select Fiyat, Tarih from Performans where Stock='" & mystock & "' and Desicion='BUY' and left(mydate,10) >='" & startingdate & "';"where mydate field is described as Date in SQL table and startingdate is calculated also as date format...However this select command does not return the values after a certain date which is given with startingdate... Thanks in advance
View Replies !
How To Format A Date Field
Hi,comming from php/mysql some things here on this side are great - but some seems to be solved in a way I can not figure out.What I need is a way to get a string in the format "yyyy-mm" out of a date-time field like:09/05/2006 23:12:36   should produce    2006-09    as one stringWhat I figured out by my own is: SELECT { fn CONCAT({ fn CONCAT(DATENAME(yyyy, dateField), '-') }, STR(DATEPART(mm, dateField))) }, ...but this returns "2006-    9" with blanks in it. Or I could use 2 times the DATENAME but this would give 2006-September.Would it help to use a stored procedure?Thanks,Klaus
View Replies !
Updating Date Field
All other fields are updating ok and I'm not getting an error.I am trying to update a date and time (smalldatetime) using a stored procedure.First, the info to be updated comes from a datagrid. Dim sDate As DateTime sDate = CType(e.Item.FindControl("tDate"), TextBox).TextThen, passed to the SQLDal class and then to the stored procedure..... Public Function updateData(ByVal sDate As DateTime, ByVal sp As String) 'Some items snipped for easier read Dim command As SqlCommand = New SqlCommand(sp, conn) 'Where sp is the stored procdure name command.Parameters.Add("@date", sDate)'And so on.....And then the stored procedure....@num VARCHAR(256),@date SMALLDATETIME,@contact VARCHAR(256),@notes VARCHAR(8000),@media VARCHAR(256) ASBEGIN DECLARE @errCode INT BEGIN TRAN -- UPDATE THE RECORDS UPDATE dbo.tblData SET fldDate = @date, fldContact = @contact, fldNotes = @notes, fldMedia = @media WHERE fldNum = @num <sniped>Like I said, all other fields are updated with no problems, but not the date.The date format being passed into the sp is {0:MMM dd, yyyy hh:mm tt} or Aug 05, 2005 04:39 PM Is it the format of the date? Or something else I'm not seeing...Thanks all,Zath
View Replies !
Getting Just The Date Or From DateTime Field
Hi, I have used smalldatetime datatype to store my date and time values. i want to store just the date or time but the problem is it stores both the date and time. For eg, if i add the the date 03/11/2004, it also the stores the current time automatically. so the new value will be something like 03/11/2004 10:00:00 AM where i want just 03/11/2004. further problem is even though i managed to store just the date like 03/11/2004 in the database, whole date and time shows up when i display it in my pages. any help will be appreciated. thanx,
View Replies !
Searching By A Date Field
I'm using the .NET Framework 1.1 together with SQL Server 2005 Beta. I have a search page where you can search a db using a number of fields or combination thereof. Three are text fields (patient id, surname, forename) and I can do any search using one criteria or any combination without any problem. However, I'd also like to search on a dob (datetime field in SQL Server) and I'm having real problems in making this work. The dates are stored in the following way in SQL Server: '1938-05-31 00:00:00.000', whilst they are displayed as 'dd/mm/yyyy' on a web page, which I guess corresponds to my regional settings. My code is shown below. I 've tried any number of combinations for the dob string with no success. I do not get any error, just no records are returned. Does anyone have any idea what I'm doing wrong and how to correct it before this drives me crazy?! TIA for any help. P.S. chxPatID, chxSurname etc are all checkboxes. <code starts> If chxPatID.Checked Then strSQL = strSQL & " patid= '" & txtPatID.Text & "' " strAND = " AND " End If If chxSurname.Checked Then strSQL = strSQL & strAND & " surname ='" & txtSurname.Text & "' " strAND = " AND " End If If chxForename.Checked Then strSQL = strSQL & strAND & " forename='" & txtForename.Text & "' " strAND = " AND " End If If chxDoB.Checked Then strSQL = strSQL & strAND & " dob= " & CDate(Year(txtDoB.Text) & "-" & Month(txtDoB.Text) & "-" & Day(txtDoB.Text)) & "" End If </code ends>
View Replies !
Date From Datetime Field
Hi What is the best practice to get the date from a smalldatetime field without the time. The table contains 5 minute readings for energy consumption in the column period. Now i need to get all the readings form some dates. SELECT dbo.TBL_Data.* FROM dbo.TBL_Data WHERE (Period IN (CONVERT(DATETIME, '2003-12-31', 102), CONVERT(DATETIME, '2004-01-01', 102))) this result contains only the readings for the timestamp 00:00 so how to select the whole day ? kind regards piet
View Replies !
Question: Date Field
Using SQL2000, to give a little history. Original data stored on DB2, andtransferred on MySQL into one table with 50 fields and more than 500,00+records. This then gets transferred to sqlserver via DTS, also in the samestructure as MySQL.The exception of one field, where shipping_date was assigned as "decimal"data type on DB2 and MySQL.On sqlserver, I changed the datatype to "datetime", it gets convertedthrough DTS.The reason why I made the change is because it is quicker to retrieve thedata and for assigning indexes. Am I wrong with this justification? Nowupper mgnt is questioning me about it.What would be the disadvantage if I were to leave "shipping_date" asdecimal? data looks like yyyymmdd (20040201), my concern since the table isnot normalized and and it takes forever to drop and re-create the indexes,that I have totally abandoned the indexes.Please advise, TIA!Bob
View Replies !
Date / Time Field
Dear Frends Iam using SQL Server 2000 Is there any way to use Date time field to store value before the Date 01-Jan-1753? Thanks
View Replies !
Date Field Issue
I have column 'date' and its data type is datetime. But when I try to sort this column by date Its not doing the sort. What could be the reason.It was working fine until last 1 ort 2 days. Thanks.
View Replies !
SQL Date Field To String
I am running a converted DTS package which executes a stored procedure which extracts fields from a SQL database table and puts them to a flat file. Two of the fields are datetime fields. The stored procedure does not convert the dates, and under SQL 2000 DTS the fields extract as strings in format yyyy-mm-dd hh:mms. When this gave me an error in SSIS, I added a data conversion task between the Ole DB Source and the Text file destination to convert the two fields to DT_STR format and used the converted fields in my mapping for the text file. I am still getting an error on this: -1071636319,0x,Data conversion failed. The data conversion for column "mm_hdr_process_date" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page." The target code page is 1252 (ANSI) and I have tried several variations of length, and I still get this error. Any suggestions? I would prefer not to have to change every stored procedure we have which may do this. Thanks for any help. MaryKate
View Replies !
Calculate Date Field
I want to get the number of days pending for a perticular column. I want the out put as a integer value. This is what I used for my calculated field. But when i write this day is underlined in red. It says unrecognized identifier. =DATEDIFF(Day, GETDATE(),Fields!SubmittedDate.Value) If I use "day", then it is not underlined but still it does not work. When I use following query, I get no error message. but still no data in the column too. =DATEDIFF("d", Fields!SubmittedDate.Value, "GETDATE()" ) Can anyone tell me why is that? Thanks
View Replies !
Slow Date Field
Migrated from Access 2003 to Access 2007. I have an issue now with date fields on an attached Oracle 9i table. After opening the table in Access 2007, then clicking on a date field, it takes about 90 seconds before you can either pick a date or enter a date in this field. This Oracle table is about 176,000 records. A smaller Oracle table of about 3,000 records takes about 2 seconds to access a date field. The problem appears to be only date fields, text fields appears to access imediately. The tables are attached via ODBC, and I have tried to change ODBC drivers from native oracle to MS oracle drivers, with no help. Interesting though, when I drop the table link and re-establish the link, the problem goes away, until I close Access 2007 and re-open it, then the problem re-appears. That is with either ODBC drivers. This issue doesn't exsist on ACCESS 2003 and anyone using ACCESS 2007 here, have the same problem, so it isn't computer related ( the ACCESS 2007 database is network as is the 2003 version).
View Replies !
Get Date Only From Datetime Field!
OK, I know this is really simple but I can't get my statement to pull just the date from a datetime field! Here's my query: select * from tblPR where date between convert(datetime, dateadd(day,-day(getdate())+1,getdate()),103) and convert(datetime, dateadd(day,-day(getdate()),dateadd(month,1,getdate())),103) I get no errors but I get the timestamp too and I only want the date. Where am I going wrong?! Thanks in advance, Brett
View Replies !
Date Field Cannot Be Null!
Visual Basic 2005 Professional Edition: I have an SQL database table that includes a BirthDate field. I would like to have this field as optional when adding a record, but, SQL insists on throwing an exception if the field is null.
View Replies !
SP Designer Date Field
I have a workflow and when the request is completed in the email body I have included the completed date field - when the email is sent the date and time show and time is always 12 am. I really don't want the time - In sharepoint list I have in the field specifically said Date only - What or how can this be changed in SP Designer workflow email embedded code for Completed Date field. Completed Date: 5/30/2008 12:00:00 AM within the mail body I can't make any changes in the embedded code..... Thanks
View Replies !
Check If Field Is All Date
Hey all, I've been ehre off and on when I've needed help. And I know someone answered my question last time with the exact info I needed. But I seem to have lost the query I saved. I pretty much need a query that can filter a field I have adn pull up any records that are not in in date format. My current field is text and I'm trying to convert it over to DateTime but am getting stuck. Seems at least one of the records does not have a date format. Thank you all.
View Replies !
Doing A 'between' On A NULL In A Date Field
Hi everyone, I have two tables - caseinfo and steps. Caseinfo shows when a particular case entered and exited a particular project. If the project hasn't ended yet, then the end date is NULL. Steps shows the steps the case has gone through and the dates of those particular steps. I need to join the tables to show the steps the case went through during a particular project, but I'm having trouble with the NULL values in the end dates. If I join the tables so that the step date is between the start and end dates of the project, then I get no step information for the cases where the end date is NULL (that is, where the project hasn't ended yet). Does anybody have any ideas? Here are my tables, the query that shows the main idea (with the wrong result), and my expected results. Thank you for reading. --- create sample data set dateformat ymd declare @caseinfo table (caseid int, startdate smalldatetime, enddate smalldatetime) insert @caseinfo select 10, '2006-12-23', '2006-12-27' union all select 20, '2006-12-23', NULL union all select 30, '2006-12-23', NULL union all select 40, '2007-1-15', '2007-3-4' declare @steps table (caseid int, stepnumber int, stepdate smalldatetime) insert @steps select 10, 1, '2006-12-24' union all select 10, 2, '2007-1-3' union all select 10, 3, '2007-2-5' union all select 20, 1, '2006-12-26' union all select 20, 2, '2007-1-7' union all select 20, 3, '2007-1-9' union all select 30, 1, '2007-1-14' union all select 40, 1, '2007-1-23' union all select 40, 2, '2007-3-2' union all select 40, 3, '2007-4-16' --- the main idea (with the wrong results) select * from @caseinfo c left join @steps s on s.caseid = c.caseid and s.stepdate between c.startdate and c.enddate --- expected result declare @expresult table (caseidexp int, startdateexp smalldatetime, enddateexp smalldatetime, stepnumberexp int, stepdateexp smalldatetime) insert @expresult select 10, '2006-12-23', '2006-12-27', 1, '2006-12-24' union all select 20, '2006-12-23', NULL, 1, '2006-12-26' union all select 20, '2006-12-23', NULL, 2, '2007-1-7' union all select 20, '2006-12-23', NULL, 3, '2007-1-9' union all select 30, '2006-12-23', NULL, 1, '2007-1-14' union all select 40, '2007-1-15', '2007-3-4', 1, '2007-1-23' union all select 40, '2007-1-15', '2007-3-4', 2, '2007-3-2' select * from @expresult
View Replies !
Gridview Date Field Not Updating
Hi - Once again I've been looking at this forever and not able to see the problem. Have a grid table everything updates except the training date field. That get's wiped out each time - no matter if something is in it or not. Everything else updates correctly. Here's the code: <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="ds1" DataKeyNames="eventID"><Columns><asp:CommandField ButtonType="Button" ShowEditButton="True" ShowDeleteButton="True" /><asp:BoundField DataField="eventID" HeaderText="ID" SortExpression="eventID" ReadOnly="True"><HeaderStyle Font-Bold="True" Font-Names="Verdana" Font-Size="Small" /><ItemStyle Font-Names="Verdana" Font-Size="Small" /></asp:BoundField><asp:TemplateField HeaderText="Training Date" SortExpression="trainingDate"><EditItemTemplate><asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("trainingDate", "{0:M/dd/yy}") %>'></asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="Label1" runat="server" Text='<%# Bind("trainingDate", "{0:M/dd/yy}") %>'></asp:Label></ItemTemplate><HeaderStyle Font-Bold="True" Font-Names="Verdana" Font-Size="Small" /><ItemStyle Font-Names="Verdana" Font-Size="Small" /></asp:TemplateField> <asp:SqlDataSource ID="ds1" runat="server" ConnectionString="<%$ ConnectionStrings:TrainingClassTrackingConnectionString %>" ProviderName="<%$ ConnectionStrings:TrainingClassTrackingConnectionString.ProviderName %>"UpdateCommand="UPDATE [trainingLog] SET [trainingDate] = @trainingDate WHERE [eventID] = ?" > <UpdateParameters><asp:Parameter Name="trainingDate" Type="DateTime" /></UpdateParameters>
View Replies !
How To Insert Null Into Date Field?
hi all!I have a task, for example, to create a record for bill. I have table which represents this bill entity (Bill_ID, Amount, CreationDate, ExposureDate, PaymentDate)In table definition date fields allow null. I would like to create bill, which means insert record: (new_bill_id, 1000, 2007.12.11, null, null) But it couses exception. Smth like: System.Data.SqlTypes.SqlTypeException, date should be not null. How could I do it?Please advice!
View Replies !
How To Retrive Date(alone) From Datetime Field
hai In my web application i want to bind data from sql 2005 to ultrawebgrid, when i use source code dim cmdselect as sqlcommand dim cmdstring as string cmdstring="select name, datefieldname from tablename" cmdselect=new sqlcommand(cmdstring,connectionstring) connectionstring.open() ultrawebgrid1.datasource=cmdselect.executenonquery() ultrawebgrid1.databind() connectionstring.close() ----- when i execute above coding i am geting date and time displayed there, but i want to display date alone --my datefield datatype is datetime - i am using sql 2005,(vs2005-vb/asp.net) please help me thanks in advance
View Replies !
|