hey,
i have a problem in adding data from MS SQL(mdf file) database to datagrid view:
the code is below
please can someone help me with this.
C# Syntax
db.openConnection();
String query4 = @"Select TActionDes,TAssignedTo,TDueDate,TStatus,TDateComplete,TComment From TopicAction Where TopicNo = @topicNo and Phase = @phase";
SqlCommand command4 = new SqlCommand(query4, DB.getConnection());
command4.Parameters.Add("@topicno", SqlDbType.VarChar).Value = TopicNo;
command4.Parameters.Add("@phase", SqlDbType.Int).Value = Phase;
SqlDataAdapter adapter4 = new SqlDataAdapter(command4);
DataSet ds = new DataSet();
adapter4.Fill(ds,"Action");
//dgvDAction.DataSource = ds;
int row = ds.Tables["Action"].Rows.Count - 1;
for (int r = 0; r < row; r++)
{
dgvDAction.Rows[0].Cells[1].Value = ds.Tables["TActionDes"].Rows[r].ItemArray[1];
}
db.closeConnection();
thanxxxxxxx