Click here to Skip to main content
15,906,816 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
string queryString =
        "SELECT * FROM ContactDetails;";

    using (SqlConnection connection =
               new SqlConnection(connectionString))
    {
        SqlCommand command =
            new SqlCommand(queryString, connection);
        connection.Open();

        SqlDataReader reader = command.ExecuteReader();


        while (reader.Read())
        {
            Here i want to encode each value 
        }


        reader.Close();
    }


What I have tried:

C#
string queryString =
        "SELECT * FROM ContactDetails;";

    using (SqlConnection connection =
               new SqlConnection(connectionString))
    {
        SqlCommand command =
            new SqlCommand(queryString, connection);
        connection.Open();

        SqlDataReader reader = command.ExecuteReader();


        while (reader.Read())
        {
            Here i want to encode each value 
        }


        reader.Close();
    }
Posted
Updated 5-Jan-21 3:55am
v2
Comments
PIEBALDconsult 5-Jan-21 9:59am    
First, please don't use "SELECT *" in production code.
Second, I'm unsure what you are asking.
If you want to add a column with a set value, you can add that to the query, kinda like : SELECT ... , 'foo' AS "bar" ...
My Oracle-Fu is rusty, so that syntax may not be exactly correct.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900