03-03-23, 08:01 PM
أرغب في التعديل على كود حفظ الدرجـات حسب المـادة المختارة من (CombCourses)
مع العلم أن رقم الطالب ورقم الصف ورقم الفصل يتم حفظها في الجدول؛ ولكن عند إختيار المـادة من الكومبوكس
وتعبئة الدرجات فإنه لايتم حفظها حسب أندوكس المادة
المثال في المرفقات
[attachment=28719]
مع العلم أن رقم الطالب ورقم الصف ورقم الفصل يتم حفظها في الجدول؛ ولكن عند إختيار المـادة من الكومبوكس
وتعبئة الدرجات فإنه لايتم حفظها حسب أندوكس المادة
كود :
Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; " & "Data Source=" & Application.StartupPath & "\DataBase\Data_Base.accdb")
For i As Integer = 0 To DataGridView1.RowCount - 2
Dim sql As String = "INSERT INTO TBL_Final1 (IDStudent, IDClas, IDSemester, on1, on2, on3) Values (@IDStudent, @IDClas, @IDSemester ,@on1 ,@on2 ,@on3)"
Dim cm As New OleDbCommand(sql, con)
With cm.Parameters
.AddWithValue("@IDStudent", DataGridView1.Rows(i).Cells(0).Value).DbType = DbType.String
.AddWithValue("@IDClas", DataGridView1.Rows(i).Cells(2).Value).DbType = DbType.String
.AddWithValue("@IDSemester", CombSemester.Text).DbType = DbType.String
.AddWithValue("@on", CombCourses.SelectedIndex + 1).Value = DataGridView1.Rows(i).Cells(4).Value.DbType = DbType.String
.AddWithValue("@tr", CombCourses.SelectedIndex + 1).Value = DataGridView1.Rows(i).Cells(5).Value.DbType = DbType.String
.AddWithValue("@tr", CombCourses.SelectedIndex + 1).Value = (DataGridView1.Rows(i).Cells(6).Value).DbType = DbType.String
End With
con.Open()
cm.ExecuteNonQuery()
con.Close()
MsgBox("تم رصد درجــات الصــف : " & " " & listClas.Text & Chr(13) & " لمــادة : " & CombCourses.Text & " * بنجــاح " & "", MsgBoxStyle.Information, "الإجـــراء")
Nextالمثال في المرفقات
[attachment=28719]
.