473,890 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error to converting datetime format into character string

1 New Member
hi
i have make a report with mshflexgrid. the report between two date. when i have written query

.open"select * from tablename where t_date>=convert (datetime,' " & text1.text &"') and t2_date>=conver t(datetime,' " & text2.text &"'),cn,,,adcmd text


but there is a syntex error to converting datetime format into character string

plz help me

give me solution for the same

thanks

jignesh
Jun 16 '07 #1
2 2700
pureenhanoi
175 New Member
hi
i have make a report with mshflexgrid. the report between two date. when i have written query

.open"select * from tablename where t_date>=convert (datetime,' " & text1.text &"') and t2_date>=conver t(datetime,' " & text2.text &"'),cn,,,adcmd text


but there is a syntex error to converting datetime format into character string

plz help me

give me solution for the same

thanks

jignesh
If u ensure that the data u typed into Text1 and Text2 are exactly DateTime value, so u no need to use convert function. Use following SQL statement
[PHP].open "SELECT * FROM tablename WHERE t_date>=#" & text1.text & "# AND t2_date>=#" & text2.text & "#"[/PHP]
If u not ensure those data are datetime value, so u must check the data first by using isDate() function
Jun 16 '07 #2
hariharanmca
1,977 Top Contributor
hi
i have make a report with mshflexgrid. the report between two date. when i have written query

.open"select * from tablename where t_date>=convert (datetime,' " & text1.text &"') and t2_date>=conver t(datetime,' " & text2.text &"'),cn,,,adcmd text


but there is a syntex error to converting datetime format into character string

plz help me

give me solution for the same

thanks

jignesh

first you have to define which database and getting date in Textbox is not good. Use DTPicker
Jun 16 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
38598
by: Justin Wong | last post by:
CREATE PROCEDURE dbo.Synchronization_GetNewRecords ( @item varchar(50), @last datetime ) AS SET NOCOUNT ON
11
3824
by: jguilford | last post by:
I have created a SQL Stored Procedure that uses a Case statement to determine the Order By. For one of the Case statements I am trying to turn a Char field into Datetime in for the Order By, however I can not get it to work. Can someone please take a look and my code below and tell me what I am doing wrong. Thank you. ORDER BY CASE WHEN @SortBy = 'dttm_stamp' THEN dttm_stamp End, CASE WHEN @SortBy = 'Event_Date1' THEN...
1
1593
by: Lerp | last post by:
Hi all, What do I have to do in order to get my value from my textbox that is formatted like 'mm/dd/yyyy' into a datetime database field ? Currently getting an error: Syntax error converting datetime from character string I have 2 validators on this form field as seen below along with a sub that is supposed to be called on ServerValidate (which it seems it is misfiring)
14
3411
by: eric.goforth | last post by:
Hello, I'm trying to convert a string to a date time in a C# web service. I'm passing in a string parameter and I have a localization setting in my Web.config file: My app is blowing up on the first line here, with a"Value does not fall within the expected range" error.
3
17372
by: Assimalyst | last post by:
Hi, I am trying to convert a UK formated date in a textbox to sql server format. dd/MM/yyyy -> yyyyMMdd. Here's the code: IFormatProvider format = new System.Globalization.CultureInfo("en-GB", true); DateTime dateUK = DateTime.ParseExact(DOBTxtBx.Text, "dd/MM/yyyy",
3
10917
by: Rich Robinson | last post by:
Hi, I have a web service method which takes a DateTime type as a parameter. The service is UK based, and the dates are passed in to the service in the UK format dd/MM/yyyy. On a recent install, the web service method will not accept the UK date format, erroring with a System.Argument exception, but would take US formatted dates.
6
4136
by: B.N.Prabhu | last post by:
Hi, I am having a DataTable which one column is in string format now i want to change that one to DataTime. I don't know whether its in datetime format or not i have to check if it is in DateTime Format some times it may in normal string not a DateTime. If it is in any one of the DateTime format then i have to change it as a Specfic format as "21-03-2005 11:34" using C#.Net. If its not in DateTime format then i should give a message.
2
11195
by: Brian Parker | last post by:
I am beginning to work with VB2005.NET and I'm getting some problems with string formatting converting an application from VB6. VB6 code:- sTradeDate = Format(pArray(4,i Record), "mmddyy") pArray is a variant array containing a date string at pArray(4, iRecord) in the format "yyyy/mm/dd"
1
4677
by: SnehaAgrawal | last post by:
Hi I get the error "Syntax error converting datetime from character string "for the following sql statement in Stored proc. SET @dynamicSQL =N'SELECT CUSTID,SHCodeLink FROM AccountMaster where CONVERT(DATETIME,OPDATE,105) < = '''+CONVERT(DATETIME,@ACCYEAR,105) +''' And GLCode = '+@DIVGLCODE EXEC(@dynamicsql)
0
9977
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9816
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10910
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9618
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8009
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7161
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6036
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3268
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.