By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,159 Members | 1,941 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,159 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

--

Stoitcho Goutsev (100) [C# MVP]
"Amal Ismail" <fr*********@alex4all.com> wrote in message
news:27*****************************@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

Nov 16 '05 #2

P: n/a
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" <fr*********@alex4all.com> wrote in message
news:27*****************************@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

Nov 16 '05 #3

P: n/a
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.

--
Shak
(Houston)
"Amal Ismail" <fr*********@alex4all.com> wrote in message
news:27*****************************@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

Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.