Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello developers guys
I would like any help from you, I want to know how i can make reports for my system i m developing in vbnet 2010 (visual studio 2010express) with access 2007 database.
I would to know if it is fair if I do it from access database or from vbnet.


The second question is about how I can connect the table that will hold user details to staff table(logintable) and role table, now I m using staff table wich is connect to login interface, it has username,password, RoleId, and role id has Roleid and Role.
in user details table i m having firstname,surname,lastname, RoleId and address,But I don't know how I can connect them, so that through user details table can hold the information that the staff table will be using, basically to help user registering with the system for use.

Please help me out.

Thank u
Posted
Updated 16-Jul-20 7:08am

1 solution

reporting is easiest in access itself as it provides templates but here is a simple example using OLEDB in VB .Net 2010 to open and read an access database joining two tables together.

the example is a database for a french client so the names are in french, i just created a form with a tetbox on it with scroll bars and multiline set to true but you can handle the data as you like.
VB



you can access fields either by name or by column index (zero based).

put Imports System.Data.OLEDB at the top of the class

Using conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\My Documents\DOWNLOAD\GESTION.mdb")

Using cmd As New OleDbCommand("SELECT Produits.*,Fournisseurs.Ville FROM Produits LEFT JOIN Fournisseurs ON Fournisseurs.NomFournisseur=produits.Fournisseur", conn)

Dim rd As OleDbDataReader

Try
conn.Open()

rd = cmd.ExecuteReader

Do While rd.Read
TextBox1.Text += rd(1) + " : " + rd("Ville") + vbCrLf

Application.DoEvents()
Loop

rd.Close()

Catch ex As Exception
MsgBox("Cannot Access DB." + vbCrLf + vbCrLf + ex.Message)
End Try

conn.Close()
End Using
End Using
 
Share this answer
 

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