C# Code for How to set readonly property to Id(database)
value?
Answer Posted / deepak ray
Just retrieve the id from database using reader or dataset
and store the id in a string.
and
set the string in a public readonly property like this.
string _UserId;
public string UserId
{ get { return _UserId; } }
SqlDataReader dr = null;
dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
_UserId = dr["UserId"].ToString();
}
dr.Close();
dr.Dispose();
| Is This Answer Correct ? | 10 Yes | 6 No |
Post New Answer View All Answers
How to implement an object pool in c#.net.
What are the 3 types of comments in c#?
Write a short note on interface?
What is local function?
What does an indexer do?
Explain the difference between a struct and a class?
What are handlers in c#?
What is the wildcard character in sql?
What is the difference between virtual and override in c#?
What does out mean c#?
Where do we set the min and max pool size for connection pooling?
what is the purpose of using statement in c#
What is data binding c#?
What is static class in C#?
Explain about multithreading?