تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
استفسار عن طريقة نقل البيانات من Datagridview إلى الكريستال ريبورت
#3
Imports System.Data.OleDb

Public Class Form1

Dim con As New OleDbConnection

Dim adapter As New OleDbDataAdapter

Dim dtmain_Moad, dtShoab, dtStudents As New DataTable

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

adapter = New OleDbDataAdapter(" select * from main_Moad ", con)

adapter.Fill(dtmain_Moad)

ComboBox1.DataSource = dtmain_Moad

ComboBox1.DisplayMember = "Lable"

ComboBox1.ValueMember = "ID"

Label1.Visible = False



End Sub

Public Sub New()

' This call is required by the designer.

InitializeComponent()

con.ConnectionString = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\newTemp1\newTemp1.accdb")

' Add any initialization after the InitializeComponent() call.

End Sub

Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged

Try

dtShoab.Clear()

adapter = New OleDbDataAdapter(" select * from Shoab where ID_Mada =" & ComboBox1.SelectedValue, con)

adapter.Fill(dtShoab)

ComboBox2.DataSource = dtShoab

ComboBox2.DisplayMember = "Lable"

ComboBox2.ValueMember = "ID"

Catch ex As Exception

End Try

End Sub

Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged

Try

dtStudents.Clear()

adapter = New OleDbDataAdapter(" select * from Students where Id_Shoba =" & ComboBox2.SelectedValue, con)

adapter.Fill(dtStudents)

DataGridView1.DataSource = dtStudents

Label1.Text = DataGridView1.Rows.Count - 1

Label1.Visible = False

If DataGridView1.Rows.Count - 1 > 0 Then

Label1.Visible = True

End If

Catch ex As Exception

End Try

End SubEnd Sub
(20-10-18, 08:35 PM)عبد العزيز البسكري كتب :
السّلام عليكم و رحمة الله و بركاته
و كيف يتم ملء الداتا جريد بالبيانات أخي الكريم ؟؟
تحياتي

هذا هو الكود أخي الكريم
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
RE: استفسار عن طريقة نقل البيانات من Datagridview إلى الكريستال ريبورت - بواسطة جيولوجي مبتدئ - 22-10-18, 12:15 AM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم