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

  • Thread starter Thread starter Amal Ismail
  • Start date Start date
A

Amal Ismail

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
 
Hi Amal,

You ask three time in one day. Be patient. Normally you should wait at least
three days before repost the qestion. Don't forget this is a usenet group
and there is also a time difference.

However, if nobody answers your question try to rephrase your question. It
might be not clear enough.

Or it might be not the right group to ask. In your case there is
microsoft.public.dotnet.framework.aspnet.mobile
which might be more helpful.
 
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
 
First of all i have to tell you that i am not good at SQL server.

Coming to your problem, i guess your MyDate value is in double quotes since
its a string.

Supply the MyDate variable as a VALUE (conversion required) within single
quotes instead of sending it as string which has double quotes. Then the
query may execute.
 
Back
Top