Hi All
This is a cross post between database and C#
I am writing a student app and I want to have a datagridview for all the letters sent out per student number.
On the datagridview I want a combo box that lists all the available types of letters but it must default to the letter that was sent and the date.
I have a table with all the possible kinds of letters and another table with the student number. letter type and date.
So I only want to list the letters sent to that specific student and the dates
The reason why I want all of the kinds of letters listed is because at the end of the datagridview they must be able to add a new letter
I searched a bit and it seems I need to use joins
I will attach my code, I am getting hopefully lost. It is my first project
Any assistance will be appreciated
This is a cross post between database and C#
I am writing a student app and I want to have a datagridview for all the letters sent out per student number.
On the datagridview I want a combo box that lists all the available types of letters but it must default to the letter that was sent and the date.
I have a table with all the possible kinds of letters and another table with the student number. letter type and date.
So I only want to list the letters sent to that specific student and the dates
The reason why I want all of the kinds of letters listed is because at the end of the datagridview they must be able to add a new letter
I searched a bit and it seems I need to use joins
I will attach my code, I am getting hopefully lost. It is my first project
C#:
conn = new SqlConnection(cs.DBConn);
conn.Open();
cmd = new SqlCommand("select Letters.LetterName, StudentLetter.LetterNumber, StudentLetter.DateSent from Letters, StudentLetter, Personaldata OUTER JOIN StudentLetter.LetterNumber ON Letter.LetterName WHERE StudentLetter.StudentNumber='" + studentNumberUpdater + "'", conn);
SqlDataAdapter myDA = new SqlDataAdapter(cmd);
DataSet myDataSet = new DataSet();
myDA.Fill(myDataSet);
dgvLetters.DataSource = myDataSet.Tables[0].DefaultView;
conn.Close();
Any assistance will be appreciated