Main Page | Report Page

 

  .NET DotNet Forum Index » ASP.NET Forum » Too many characters in character literal... not using char!

Author Message
PK
Posted: Mon Mar 29, 2004 2:33 pm
 
I'm getting this error message when using a conditional in a repeater:

Compiler Error Message: CS1012: Too many characters in character
literal

According to MSDN, this message means that I'm trying to initialize a
char constant with more than one character, like:

char a = 'xx'

It's disagreeing with my use of '999999999'. I think I'm using it in
a string comparison, but apparently I'm wrong. By the way, column1 is
defined as varchar, I don't know if that matters...

Has anyone else run into this problem?

Thanks!

PK




<td>
<%# ( DataBinder.Eval(Container,"DataItem.column1") ==
'999999999') ?
DataBinder.Eval(Container,"DataItem.column2") :
DataBinder.Eval(Container,"DataItem.column1") %>
</td>
 
Marina
Posted: Mon Mar 29, 2004 4:16 pm
 
You have single quotes around your string, not double quotes. Single quotes
are for characters - but that would mean only one character in the single
quotes, and you have more then that.

"PK" <yuckapoo@yahoo.com> wrote in message
news:286c5ba6.0403291133.1046c9a1@posting.google.com...
Quote:
I'm getting this error message when using a conditional in a repeater:

Compiler Error Message: CS1012: Too many characters in character
literal

According to MSDN, this message means that I'm trying to initialize a
char constant with more than one character, like:

char a = 'xx'

It's disagreeing with my use of '999999999'. I think I'm using it in
a string comparison, but apparently I'm wrong. By the way, column1 is
defined as varchar, I don't know if that matters...

Has anyone else run into this problem?

Thanks!

PK




td
%# ( DataBinder.Eval(Container,"DataItem.column1") ==
'999999999') ?
DataBinder.Eval(Container,"DataItem.column2") :
DataBinder.Eval(Container,"DataItem.column1") %
/td

 
Bryan Donaldson
Posted: Mon Mar 29, 2004 4:21 pm
 
Perhaps try "999999999"

using quotes, not apostrophes.

"PK" <yuckapoo@yahoo.com> wrote in message
news:286c5ba6.0403291133.1046c9a1@posting.google.com...
Quote:
I'm getting this error message when using a conditional in a repeater:

Compiler Error Message: CS1012: Too many characters in character
literal

According to MSDN, this message means that I'm trying to initialize a
char constant with more than one character, like:

char a = 'xx'

It's disagreeing with my use of '999999999'. I think I'm using it in
a string comparison, but apparently I'm wrong. By the way, column1 is
defined as varchar, I don't know if that matters...

Has anyone else run into this problem?

Thanks!

PK




td
%# ( DataBinder.Eval(Container,"DataItem.column1") ==
'999999999') ?
DataBinder.Eval(Container,"DataItem.column2") :
DataBinder.Eval(Container,"DataItem.column1") %
/td

 
PK
Posted: Mon Mar 29, 2004 7:38 pm
 
Solved my own problem... Had to cast database field as a string (it
was reading as an object, whatever that means).

<%#( ( Convert.ToString(DataBinder.Eval(Container,"DataItem.column1"))
== "999999999") ?
(DataBinder.Eval(Container,"DataItem.column2")) :
(DataBinder.Eval(Container,"DataItem.column1")) )%>
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Tue Sep 02, 2014 6:38 am