private void Search_Click_1(object sender, EventArgs e) { this.connetionString = "Data Source = whitesnow.database.windows.net; Initial Catalog = Mazal; Integrated Security = False; User ID = Grimm; Password = #!7Dwarfs; Connect Timeout = 15; Encrypt = False; TrustServerCertificate = True; ApplicationIntent = ReadWrite; MultiSubnetFailover = False"; this.sqlcon = new SqlConnection(connetionString); SqlCommand cmd = new SqlCommand("select ID,F_name,L_name,Telephone,Email from person where ID='" + IDbutton.Text + "'", sqlcon); StudentInfo.Visible = true; try { SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; DataTable dbdataset = new DataTable(); sda.Fill(dbdataset); BindingSource bsource = new BindingSource(); //Paint headers StudentInfo.EnableHeadersVisualStyles = false; StudentInfo.GridColor = Utility.HeaderBackColor; StudentInfo.ColumnHeadersDefaultCellStyle.BackColor = Utility.HeaderBackColor; StudentInfo.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; StudentInfo.AutoResizeColumns(); StudentInfo.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; StudentInfo.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; bsource.DataSource = dbdataset; StudentInfo.DataSource = bsource; sda.Update(dbdataset); } catch (Exception ex) { MessageBox.Show(ex.Message); } }