C# Code for How to set readonly property to Id(database)
value?

Answer Posted / karthikeyan

String connectionString = @"Data
Source=.\SQLExpress;Initial Catalog=Nwind;Integrated
Security=SSPI";
SqlConnection con = new SqlConnection(connectionString);
string conString = "Select * From Customers";
SqlDataAdapter dataAdpter = new SqlDataAdapter(conString,
con);
DataSet ds = new DataSet();
dataAdpter.Fill(ds);
ds.Tables[0].Columns[0].ReadOnly = true;
dataGridView1.DataSource = ds.Tables[0];

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is data dictionary in c#?

666


What is data set in c#?

717


List some of the common data providers for ado.net framework?

630


What happens if the inherited interfaces have conflicting method names?

782


What are mutable and immutable types in c#?

669


Explain the difference between passing parameters by value and passing parameters by reference with an example?

698


What Is A Satellite Assembly?

745


Perfect Example Of While And Do-While Loop In C#.Net ?

750


How can I create image pieces/sub image?

669


List down the differences between public, static and void keywords?

655


Can you declare a class or a struct as constant?

748


What is generic in c#?

625


HOW to Develope the CRUD(create,read,update,delete) FORM IN WINDOWS form by using c# only

734


Define the term immutable ?

807


Who is a accessibility modifier “protected internal” available to ?

780