Click here to Skip to main content
15,892,059 members

Comments by ManjIndian (Top 34 by date)

ManjIndian 18-Oct-12 1:52am View    
its won't work.
ManjIndian 11-Oct-12 1:53am View    
private void Form1_Load(object sender, EventArgs e)
{
SqlConnection con=new SqlConnection(@"Data Source=SA;Initial Catalog=bookStore;Integrated Security=True");
con.Open();
SqlCommand com = new SqlCommand("Select * from b", con);//("select title,author,genre from b",con);
SqlDataReader dr =com.ExecuteReader();
DataTable dt=new DataTable();
dt.Load(dr);
dataGridView1.DataSource = dt;
if (dataGridView1.Rows.Count < 20)
{
int r = 20 - dataGridView1.Rows.Count;
for (int i = 0; i < r; i++)
{
AddARow(dt);
}
}
dataGridView1.DefaultCellStyle.BackColor = Color.SkyBlue;
dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.White;

}
private void AddARow(DataTable table)
{

DataRow newRow = table.NewRow();


table.Rows.Add(newRow);
}
ManjIndian 10-Oct-12 7:05am View    
What you are edited?
ManjIndian 10-Oct-12 0:55am View    
thanks for the valuable suggestion..
ManjIndian 10-Oct-12 0:55am View    
thanks for the valuable suggestion..