X




By Otekpo Emmanuel/Category: Visual Basic.Net/11/30/2019 11:05:58 PM

Connecting to SQL server database

Good day everyone. Please am new hear and would really like you guys to help me out. I working on a project and requires students to register their day to day attendance details. Am really new to vb.net. Please how can I achieve this?
Vote Up(0) | Vote Down(0) | Views()


Nuelson Penuel 11/30/2019 11:31:51 PM

Though what you asked for is really wide, I would still love to help you. But please do know that not everyone will have the time to give you this kind of solution. You might be lucky at this one. Just follow the instructions below to write code cos I assumed that you already have idea of the interface design. The code below is for MS Access and VB.net
'Import the following namespaces

Import System.Data
import System.Data.OleDB

'Double click on your save button then type this codes
Dim con As New OleDB.OleDBConnection
con.ConnectionString="Provider=Microsoft.Jet.OleDB.4.0;Data source='blablabla'" 
Try

If con.State=ConnectionState.Closed Then con.Open
Dim cmd As New SqlCommand("INSERT INTO TBLUSERS(uname,gender)VALUES(@uname,@gender")
cmd.parameters.AddWithValue("@uname", txtname.Text)
cmd.parameters.AddWithValue("@gender", txtgender.Text)
cmd.ExecuteReader
cmd.Dispose
con.Close
con.Dispose
MsgBox("records saved")
Catch ex As Exception
MsgBox ex.InnerException.Message
End Try


Give feed back if you have any challenges



Other Questions
Connecting To SQL Server Database(Visual Basic.Net)
Emmason Integratded Services(2017-2024)
All Rights Reserved
Designed and Maintained By Emmason Integrated Services