Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have a database table containing:
SEG,AMK,101427Y,EG3902,EG3902-G1
SEG,AMK,101427Y,EGS650,EGS650-G1
SEG,AMK,103852S,EG3901,EG3901-G1
SEG,AMK,103852S,EG3904,EG3904-G1
SEG,AMK,103852S,EGS104,EGS104-G1
SEG,AMK,103852S,EGS650,EGS650-G1
SEG,AMK,106581C,EG3901,EG3901-G1
SEG,AMK,106581C,EG3902,EG3902-G1
SEG,AMK,111713M,EG3901,EG3901-G1
SEG,AMK,111713M,EG3902,EG3902-G1


another table containing:
1  SEG-AMK EG1832  Mechanics and Materials         286 1.5 EG1832
   2   SEG-AMK EG1833  Electrical Principles           375     1.5 EG1833  EG1952  EG1903
   3   SEG-AMK EG1835.1 Engineering Mathematics (1)    456 1.5 EG1835  EG1001
   4   SEG-AMK EG1835.2 Engineering Mathematics (2)    363 1.5 EG1907  EG1681  EG1951


i want to search for common students within exampapers
result:

example: if student 111411H is taking EG1832 in paper 1 and EG1952 in paper 2,

then:

Conflicting paper Numofstudents AdminNo
paper1 : paper2 1 111411H . . .

How to do i it?

my codes so far:

Dim dbprovider As String
       Dim dbsource As String
       Dim dspaperslist, dsmodulestudents As New DataSet
       Dim daPaperlist, daSegdata As OleDb.OleDbDataAdapter
       Dim con As New OleDb.OleDbConnection
       Dim paperslist As String
       Dim segdata As String

       dbprovider = "PROVIDER=Microsoft.Ace.OLEDB.12.0;"
       dbsource = "Data Source =" & Application.StartupPath & "\segdata.accdb"
       con.ConnectionString = dbprovider & dbsource


       con.Open()
       paperslist = "SELECT * FROM paperslist"
       daPaperlist = New OleDb.OleDbDataAdapter(paperslist, con)
       daPaperlist.Fill(dspaperslist, "paperslist")

       segdata = "SELECT * FROM ModuleStudents"
       daSegdata = New OleDb.OleDbDataAdapter(segdata, con)
       daSegdata.Fill(dsmodulestudents, "ModuleStudents")

       ''check if dataset has records
       'If dsmodulestudents.Tables(0).Rows.Count = 0 Then

       'MessageBox.Show("no records")

       ' Else

       'MessageBox.Show("records found")

       'End If

       For i As Integer = 0 To dspaperslist.Tables(0).Rows.Count - 1
           Dim found As Boolean = False
           Dim adminno As String
           For j As Integer = 0 To dsmodulestudents.Tables(0).Rows.Count - 1

           Next
       Next
       con.Close()
Posted
Updated 17-Jul-13 21:29pm
v2
Comments
Priyanka7777 17-Jul-13 1:38am    
Why are you comparing the values in the datasets,instead you can join the two tables in the SQL query.
12345_abcde 17-Jul-13 5:01am    
i just learned about it but i dont understand despite learning it on google etc.
could you help me out?
Priyanka7777 17-Jul-13 7:01am    
Join the two tables 'paperslist' and 'ModuleStudents' with the help of inner join.
12345_abcde 17-Jul-13 8:20am    
what do i do after that to search for the conflicted values?
Priyanka7777 17-Jul-13 8:32am    
You want to search for common students within exampapers,right?
You can do that using inner join.
What is the problem that you are facing?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900