I have codes of getting all the datas from mysql to datagrid view but I am stuck in getting data from mysql to the textbox. This textbox has read only property it is where the username of the login user will be displayed.
For further understanding here is the image.
Here is my code on getting mysql database to datagridview.
private void frmMain_Load(object sender, EventArgs e)
{
a = new ApareceCrudLib("localhost", "root", "", "cashieringdb");
loadDataGridView_Main();
}
public void loadDataGridView_Main()
{
dgvMain.Rows.Clear();
List<string>[] detailList = a.mysqlSelect("Select * From sales");
for (int i = 0; i < detailList.Length; i++)
{
dgvMain.Rows.Add(detailList[i][0], detailList[i][1], detailList[i][2], detailList[i][3]);
}
}
This is a personal program I do this for the business of my sister. Actually my plan is to display first the Login User example "Admin123" then I will insert the data "Admin123" to Data Grid view user which is the current user at the time they log in so basically if Admin456 will login then his name will be displayed on Login User textbox and User in DataGridView. A sort of monitoring the login activity of different user who login.