hi,
how can i add data to a datagridview cell from a SQL client database file(mdf file)
is the below code correct, it dosen't work , why is it???

C# Syntax

db.openConnection();
            String query = @"Select FirstName from Emplooyee";
            SqlCommand command = new SqlCommand(query,DB.getConnection());

            SqlDataAdapter adapter = new SqlDataAdapter();
            DataTable dt = new DataTable();

            adapter.Fill(dt);
            dgvPAction.Rows[0].Cells[1].Value = adapter.Fill(dt).ToString();

simple glance I see

SqlDataAdapter adapter = new SqlDataAdapter();

you need to declare it as something?

I presume as you you want to so this:

SqlDataAdapter adapter = new SqlDataAdapter(command);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.