Re: The third time to ask in here ... Mobile Web form

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Doug Forster (doug)
Date: 07/06/04


Date: Wed, 7 Jul 2004 11:58:32 +1200

Hi Amal,

You would be better directing sql server questions to the
sqlserver.programming group. Having said that I think your problem may be
due to not concatenating single quotes around the user entered MyDate value.
If your user can directly enter this value then you should also read about
sql injection attacks.

Cheers

Doug Forster

"Amal Ismail" <free_rhythm@alex4all.com> wrote in message
news:279c201c4639c$fc558e90$a401280a@phx.gbl...
> hello
>
> this is the third time i inquire aboutthe same
> thing and none answer me !! .. hope to find help here
> i'm using ASP.NET Mobile web application using c#
> And i'm facing a problem , i use SQL server Database
> I've table inside it a column of type smalldatetime &
> i can't change its format , and in the mobile webform
> i've a textbox the user enter a string on the format
> mm/yyyy ... i need to compare it to the date in the
>
> database And show a certain value to the user depending
> on the entered date so i either need to change the date
> format in the DB to string or the string that the user
> enter to date format
> i've tried to use this phrase in the select statement
> ex :
> string Value_select_text="select value from
> MONTHLY_Indicators_Value where convert(varchar(30),month
> (indicator_date))+'/'+convert(varchar(30),year
> (indicator_date))="+MyDate;
>
> where MyDate is the string that the user entered but it
> gave me a strange error
> Syntax error converting the varchar value '1/2002' to a
> column of data type int.
> supposing that the user entered 01/2002 as a date
>
> Best Regards
> Amal
>



Relevant Pages

  • Re: Moving a VBA function to SQL server
    ... "String Functions " in Books Online. ... The SQL server database contains a table named 'WorkOrders'. ... This will produce a job header formatted like this: ... The format he specifies is stored in table 'Settings' - field 'JobHdrMask' ...
    (comp.databases.ms-access)
  • Re: Undocumented CONVERT styles
    ... The string value will not be interpreted ... independently of the date format: ... SQL Server changes this to something else when you add it ...
    (microsoft.public.sqlserver.programming)
  • Re: datepart function
    ... Is it possible to use this function to give the format like ... If it is the case the data type will be string and no more ... Look up the function CAST and CONVERT in Books Online. ... Links for SQL Server Books Online: ...
    (microsoft.public.sqlserver.programming)
  • Re: Format a datetime columns output?
    ... you could convert the date to a string? ... SQL Server you should use the format YYYYMMDD, ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: mm/dd/yyyy format question
    ... I was not talking about how .Net or SQL Server stores date/time values ... I get the impression that you are talking about ISO 8601 in terms ... applications use the format for unambiguously representing date/time ...
    (microsoft.public.dotnet.languages.vb)