Note that there are some explanatory texts on larger screens.

plurals
  1. POData in data grid view won't show visually C# SQL
    primarykey
    data
    text
    <p>I have this data grid view like this:</p> <p><img src="https://i.stack.imgur.com/lhKo3.jpg" alt="enter image description here"></p> <p>But it should be like this:</p> <p><img src="https://i.stack.imgur.com/dN1qj.jpg" alt="enter image description here"></p> <p>The data is successfully fetched but I have to drag the cells so the data can be shown. This is the code:</p> <pre><code>private void button5_Click_1(object sender, EventArgs e) { sqlConnStaff(); groupBoxRoom.Visible = false; groupBoxDPenghuni.Visible = false; groupBoxPenghasilan.Visible = false; groupBoxPenghuni.Visible = false; groupBoxStaff.Visible = true; GroupBox_AddResident_Resident.Visible = false; GroupBox_AddResident_Room.Visible = false; GroupBox_AddResident1.Visible = false; GroupBox_DeleteResident_Resident.Visible = false; GroupBox_DeleteResident1.Visible = false; GroupBox_Resident.Visible = false; GroupBox_Update_Room.Visible = false; GroupBox_UpdateResident1.Visible = false; } private void sqlConnStaff() { BindingSource dbBindSource = new BindingSource(); SqlCommand com; com = new SqlCommand(); SqlConnection con = new SqlConnection(strCon); com.Connection = con; com.CommandType = CommandType.StoredProcedure; com.CommandText = "view_staff"; SqlDataAdapter dataAdapter = new SqlDataAdapter(com); IDCabang = new SqlParameter(); IDCabang.SqlDbType = SqlDbType.VarChar; IDCabang.Size = 5; IDCabang.ParameterName = "@IDCabang"; IDCabang.Value = IDCabangC; IDCabang.Direction = ParameterDirection.Input; com.Parameters.Add(IDCabang); con.Open(); DataTable table = new DataTable(); table.Locale = System.Globalization.CultureInfo.InvariantCulture; dataAdapter.Fill(table); dbBindSource.DataSource = table; dataGridView3.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader); // you can make it grid readonly. dataGridView3.ReadOnly = true; // finally bind the data to the grid dataGridView3.DataSource = dbBindSource; con.Close(); } </code></pre> <p>Whats wrong and what should I do?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload