32
of 76
TEP , The Engineering Projects , Image

syedzainnasir

TEP , The Engineering Projects , Rating 7.5 7.5 / 10
TEP , The Engineering Projects , Icon Level: Moderator
TEP , The Engineering Projects , Icon Joined: 20 Mar 2022
TEP , The Engineering Projects , Icon Last Active: 2:21 PM
TEP , The Engineering Projects , Icon Location: TEP , The Engineering Projects , Flag
TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon TEP , The ENgineering Projects , Icon
How to save data from checkedlistbox to access database?
TEP , The Engineering Projects , Calender Question: 07-Mar-2017
TEP , The Engineering Projects , Category In: Microsoft Visual Studio Projects
Hello. I'm having trouble with inserting data to a database based on items checked on a checkedlistbox. There are two and the data on the checkedlistboxes are also from the same database but from different tables and they will serve as foreign keys to the table where I need to save them. I need it so that when the user finishes selecting the items and click the button, it would instantly save it to the database. Here is the code that I use to get the data from the database for both checkedlistboxes:
[code]Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load Using connection As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\rose&mike\Desktop\DbSysDel3\salondbaccess.accdb"), adapter As New OleDbDataAdapter("SELECT Service_Name, Service_Fee FROM [Service_Types]", connection) Dim sql As String = "Select Lastname FROM Employees2" Dim cmd As New OleDbCommand cmd = New OleDb.OleDbCommand(sql, connection) connection.Open() Dim dr As OleDbDataReader = cmd.ExecuteReader If dr.HasRows Then While dr.Read chcklstbx2.Items.Add(dr(0)) End While End If Dim table As New DataTable adapter.Fill(table) With chcklstbx1 .DataSource = table .DisplayMember = "Service_Name" .ValueMember = "Service_Fee" End With connection.Close() End Using End Sub[/code]
TEP , The Engineering Projects , Icon Answer: 0 TEP , The Engineering Projects , Icon Views: 150 TEP , The Engineering Projects , Icon Followers: 85
Small Bio
TEP , The Engineering Projects , Tags
PLC
Robot
STM32
Arduino
AI
ESP32
Ladder Logic
PLC Projects
Programming
Communicates STM32
PLC Projects
Communicates PLC
Font Style
Alignment
Indenting and Lists
Insert Media
Insert Items

Want to leave an answer!

Word Count :0 Draft Saved at 12:42 am.