13-10-15, 05:24 AM
الله يعافيك
العفو ما سويت لك شيء يذكر
الاستفهامات تمثل عدد الحقول ومالها دخل بالتاريخ
لاجل كتابة التاريخ دوت الوقت
زي كذا كيف يعني؟
بارك الله فيك اضفت حقل في الجدول عشان تحفظ فيه التواريخ؟
ممكن نشوف محاولاتك في التعديل؟
رح لقاعدة البيانات واضف حقل جديد سمه
Dates
وانسخ كامل كود الفورم من هنا
واحذف جميع كود الفورم واعمل لصق
شغل المشروع وشوف
بالتوفيق
العفو ما سويت لك شيء يذكر
الاستفهامات تمثل عدد الحقول ومالها دخل بالتاريخ
لاجل كتابة التاريخ دوت الوقت
PHP كود :
TextBox1.Text= Date.Now.ToString("dd/MM/yyyy")
بارك الله فيك اضفت حقل في الجدول عشان تحفظ فيه التواريخ؟
ممكن نشوف محاولاتك في التعديل؟
رح لقاعدة البيانات واضف حقل جديد سمه
Dates
وانسخ كامل كود الفورم من هنا
PHP كود :
Imports System.Data.OleDb
Public Class Form1
Public Cn As New OleDbConnection("provider=microsoft.Ace.oledb.12.0;data source= " & Application.StartupPath & "\database.accdb")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DataGridView1.ColumnCount = 3
DataGridView1.Columns(0).Name = "Code"
DataGridView1.Columns(1).Name = "Sciences"
DataGridView1.Columns(2).Name = "Mathematics"
Dim row As String() = New String() {"1", "5", "10"}
DataGridView1.Rows.Add(row)
row = New String() {"3", "20", "30"}
DataGridView1.Rows.Add(row)
DataGridView2.ColumnCount = 3
DataGridView2.Columns(0).Name = "Code"
DataGridView2.Columns(1).Name = "Programming"
DataGridView2.Columns(2).Name = "computerscience"
DataGridView2.Rows.Add(row)
row = New String() {"2", "40", "30"}
DataGridView2.Rows.Add(row)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'DatabaseDataSet.SAVE1' table. You can move, or remove it, as needed.
Me.SAVE1TableAdapter.Fill(Me.DatabaseDataSet.SAVE1)
'TODO: This line of code loads data into the 'DatabaseDataSet.Reports1' table. You can move, or remove it, as needed.
Me.Reports1TableAdapter.Fill(Me.DatabaseDataSet.Reports1)
End Sub
Private Sub Reports1BindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Validate()
Me.Reports1BindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.DatabaseDataSet)
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
SAVE1DataGridView.DataSource = Nothing
SAVE1DataGridView.ColumnCount = 8
SAVE1DataGridView.Columns(7).Name = "Date"
For i As Integer = 0 To Reports1DataGridView.Rows.Count - 2
SAVE1DataGridView.Rows.Add(Reports1DataGridView.Rows(i).Cells(0).Value, Reports1DataGridView.Rows(i).Cells(1).Value,
Reports1DataGridView.Rows(i).Cells(2).Value
)
For u As Integer = 0 To DataGridView1.Rows.Count - 2
If Reports1DataGridView.Rows(i).Cells(0).Value = DataGridView1.Rows(u).Cells(0).Value Then
SAVE1DataGridView.Rows(i).Cells(4).Value = (DataGridView1.Rows(u).Cells(1).Value)
SAVE1DataGridView.Rows(i).Cells(3).Value = (DataGridView1.Rows(u).Cells(2).Value)
End If
Next
For G As Integer = 0 To DataGridView1.Rows.Count - 2
If Reports1DataGridView.Rows(i).Cells(0).Value = DataGridView2.Rows(G).Cells(0).Value Then
SAVE1DataGridView.Rows(i).Cells(5).Value = (DataGridView2.Rows(G).Cells(2).Value)
SAVE1DataGridView.Rows(i).Cells(6).Value = (DataGridView2.Rows(G).Cells(1).Value)
End If
' here new column for viewing date
SAVE1DataGridView.Rows(i).Cells(7).Value = Date.Now.ToString("dd/MM/yyyy")
' for saving it you need create new field in Table
Next
Next
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
For i As Integer = 0 To SAVE1DataGridView.Rows.Count - 2
Dim Cmd As New OleDbCommand("Insert into SAVE(code,name,class,Mathematics,Sciences,computerscience,Programming,dates)values(?,?,?,?,?,?,?,?)", Cn)
If Cn.State Then Cn.Close()
Cn.Open()
Cmd.Parameters.AddWithValue("@code", SAVE1DataGridView.Rows(i).Cells(0).Value)
Cmd.Parameters.AddWithValue("@name", SAVE1DataGridView.Rows(i).Cells(1).Value)
Cmd.Parameters.AddWithValue("@class", SAVE1DataGridView.Rows(i).Cells(2).Value)
Cmd.Parameters.AddWithValue("@Mathematics", Val(SAVE1DataGridView.Rows(i).Cells(3).Value))
Cmd.Parameters.AddWithValue("@Sciences", Val(SAVE1DataGridView.Rows(i).Cells(4).Value))
Cmd.Parameters.AddWithValue("@computerscience", Val(SAVE1DataGridView.Rows(i).Cells(5).Value))
Cmd.Parameters.AddWithValue("@Programming", Val(SAVE1DataGridView.Rows(i).Cells(6).Value))
' here you should write values to new filed in Table
Cmd.Parameters.AddWithValue("@Dates", Val(SAVE1DataGridView.Rows(i).Cells(7).Value))
Cmd.ExecuteNonQuery()
Next
End Sub
End Class
شغل المشروع وشوف
بالتوفيق
سبحان الله والحمدلله ولا إله إلا الله والله أكبر
اللهم اغْفِرْ لِلمؤمنين والمؤمنات والمسلمين والمسلمات الأحياء منهم والأموات


