Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 29, 2008 08:16 AM by Backe08
Member
21 Points
24 Posts
Mar 28, 2008 08:02 AM|LINK
Hi,
string strTemp = reader2[
What´s wrong? Thanks in advance!
Contributor
7064 Points
1444 Posts
Mar 28, 2008 09:47 AM|LINK
That is a declaration (of strTemp), but can't give more specific help or alternatives without more context.
All-Star
26580 Points
3693 Posts
MVP
Mar 28, 2008 09:53 AM|LINK
can you post your code ?
i think you might have code something like...
if (CONDITION) string strTemp = reader2["StartDate"].ToString();
cant be written like that in C#...
it should like
if (CONDITION) { string strTemp = reader2["StartDate"].ToString(); }
Compiler Error CS1023 (C#)
Statements - C# Nuts and Bolt - Beta2
hope it helps./.
Mar 29, 2008 08:16 AM|LINK
Thanks for the hlep. You were right. I had put the statement within a While-statement, like so..
while (reader2.Read())
{
Thanks again!
Backe08
Member
21 Points
24 Posts
Embedded statement cannot be a declaration or labeled statement
Mar 28, 2008 08:02 AM|LINK
Hi,
When I try to run this code I get an error reading "Embedded statement cannot be a declaration or labeled statement".string strTemp = reader2[
"StartDate"].ToString();What´s wrong? Thanks in advance!
rjcox
Contributor
7064 Points
1444 Posts
Re: Embedded statement cannot be a declaration or labeled statement
Mar 28, 2008 09:47 AM|LINK
That is a declaration (of strTemp), but can't give more specific help or alternatives without more context.
kaushalparik...
All-Star
26580 Points
3693 Posts
MVP
Re: Embedded statement cannot be a declaration or labeled statement
Mar 28, 2008 09:53 AM|LINK
can you post your code ?
i think you might have code something like...
if (CONDITION)
string strTemp = reader2["StartDate"].ToString();
cant be written like that in C#...
it should like
if (CONDITION)
{
string strTemp = reader2["StartDate"].ToString();
}
Compiler Error CS1023 (C#)
Statements - C# Nuts and Bolt - Beta2
hope it helps./.
[KaushaL] || BloG || Twitter
Don't forget to click "Mark as Answer" on the post that helped you.
Backe08
Member
21 Points
24 Posts
Re: Embedded statement cannot be a declaration or labeled statement
Mar 29, 2008 08:16 AM|LINK
Thanks for the hlep. You were right. I had put the statement within a While-statement, like so..
while (reader2.Read())
string strStart = reader2["cgpStartDate"].ToString();{
Thanks again!