Hello everyone, I've been putting of this project for years but now I see an oppertunity to learn a new skill and code in VB. At uni I learnt code in VBA in Access but I want to be able to link my relational database to a VB front end. Going through countless Youtube videos I'm still non the wiser. I managed to create my first login form and link that to the database that I'm so proud of. As part of that I created a module that connects VB to the database see below Module Module1 and this works.
So having this connection how do I link say textbox1; Textbox2 and a combo box to my database. Please be as basic as possible as I'm just learning. I have put on the Student add form
Imports System.Data.OleDb
Imports System.IO
------------------------------------------------------------------------------------------------------------
'Module1
Public cn As New OleDb.OleDbConnection
Public cmd As New OleDbCommand
Public da As New OleDbDataAdapter
Public ds As New DataSet
Public ds1 As New DataSet
Public ds2 As New DataSet
Public str As String
Public Sub conn()
cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=C:\Users\NewViper\Desktop\MHS ICT Data BaseV3Beta.accdb"
End Sub
End Module
--------------------------------------------------------------------------------------------------
'Here is the Student Add Form that I created but getting lost and confused
ds.Clear()
'datetimepicker1.value = DateTime.Now
If cn.State = ConnectionState.Open Then
cn.Close()
End If
Module1.conn()
cn.Open()
cmd.Connection = cn
cmd.CommandText = "insert into TblUser(UserNameID, UserschooID,Forname,Surname,GenderID,HouseID,YearGroup)" &
= values(" & me.txtUsername.text & ", " ")