1

I have a column name as CREATEDATE. I use this sqlcommand to get the information

string sql = "SELECT USERID,USERNAME,USERPOSITION,UPDATEUSERID,USERSTATUS,TO_CHAR(CREATEDATE, 'DD-MM-YYYY HH24:MI:SS') FROM USERMASTER WHERE USERID ='" + stat[0] + "'";

I bind them in to dataset ds.

when I want to get the data of TO_CHAR(CREATEDATE, 'DD-MM-YYYY HH24:MI:SS')

I try to assign this way.

lblCreatedOn.Text = ds.Tables[0].Rows[0]["TO_CHAR(CREATEDATE, 'DD-MM-YYYY HH24:MI:SS')"].ToString();

its throw me an error call Column 'TO_CHAR(CREATEDATE, 'DD-MM-YYYY HH24:MI:SS')' does not belong to table Table.

anyone know what the column would be?

Lalit Kumar B
  • 47,486
  • 13
  • 97
  • 124
Lst Patrick
  • 123
  • 6
  • 19

1 Answers1

4

Sometimes in few applications, the alias needs the keyword AS to qualify as an alias. Or, may be you need quoted identifier, i.e. use double-quotation marks.

So, modify it as:

TO_CHAR(CREATEDATE, 'DD-MM-YYYY HH24:MI:SS') AS "CREATEDATE"
Lalit Kumar B
  • 47,486
  • 13
  • 97
  • 124