Fill a CheckedListbox from a database based on checked values of another CheckedListbox

I am using SQL Server 2016 Visual studio 2017.

Need to fill checkedlistbox2, from my database, based on the value of the SelectedItem of Checkedlistbox1.

I am filling checkedlistbox1 on [login to view URL] as below: This code is working.

Private Sub fillChkboxList()

Dim conn As New SqlConnection("Data Source=[login to view URL];user id=sa;password=XXXX@123;database=XXXXXXX")

Dim sda As New SqlDataAdapter("select DepartmentName, DepartmentID from DepartmentMain where active=1 order by DepartmentName", conn)

Dim dt As New DataTable

[login to view URL](dt)

[login to view URL] = dt

[login to view URL] = "DepartmentName"

[login to view URL] = "DepartmentID"

End Sub

Here I am trying to use a method to fill Checkedlistbox2, which I am calling in the ItemCheck event handler of Checkedlistbox1:

Below Code is not giving required results

Public Function fillChkboxListSub()

Dim i As Integer

Dim conn1 As New SqlConnection("Data Source=[login to view URL];user id=sa;password=XXXX@123;database=XXXXXXX")

With CheckedListBox2

For i = 0 To [login to view URL] - 1 Step i + 1

If [login to view URL](i) = [login to view URL] Then

Dim xx As String = (CType([login to view URL](i), DataRowView))("DepartmentID")

Dim sqlstr2 As String = "select SubName,SubDeptID from DepartmentSub where active=1 and DepartmentID in ('" & xx & "') order by SubName"

Dim command2 As New SqlCommand(sqlstr2, conn1)

Dim adpt2 As New SqlDataAdapter(command2)

[login to view URL] = command2

[login to view URL](dt2)

[login to view URL] = dt2

[login to view URL] = "SubName"

[login to view URL] = "SubDeptID"

End If


End With

End Function

This function I am calling on:

Private Sub CheckedListBox1_ItemCheck(sender As Object, e As ItemCheckEventArgs) Handles [login to view URL]


End Sub

I am not getting the result.

If I check the (DepartmentName) in checkedlistbox1, SubDeptName should load in checkedlistbox2. If I deselect the same in checkedlistbox1, it should be deleted or removed from checkedlistbox2Please help with working code example. Thanks in Advance

Habilidades: Microsoft SQL Server , SQL, .NET, VB.NET

Veja mais: website project aspnet using using sql server, sample pos system project using sql server, using sql server jsp dreamweaver, sql server bids visual studio, payroll software using sql server, role based authentication using sql server 2005 aspnet, programming stock management software using sql server database, sql server 2008 visual studio 2008 arcgis, how to connect database in asp.net with sql server in visual studio 2012, how to connect database in asp.net with sql server in visual studio 2010, how to connect database in asp.net with sql server in visual studio 2017, want to fetch data from database based on dropdownlist selection using php, display data from database based on dropdown selection using ajax?, using angular cli with visual studio 2017, databinding in wpf datagrid control using sql server database, enable sql server debugging visual studio 2017, sql server for visual studio 2019, how to use sql server with visual studio, how to use sql server in visual studio 2017, send email in a tabular format using sql server database mail

Acerca do Empregador:
( 0 comentários ) New Delhi, India

ID do Projeto: #31567382

10 freelancers estão ofertando em média ₹443/hora nesse trabalho


I have a experience in asp.net, MVC, web API,Laravel,Php,,Java, Spring mvc,Hibernate, c#, SQL, entity framework,linq, razor view (Cshtl), html, Wordpress,Joomla,Shopify,Jstl,bootstrap,Angular JS, Jquery, Json,XML, repo Mais

₹333 INR / hora
(34 Comentários)

Hello, I am software developer more than 10 years. I have developed desktop apps with Vb.Net and MS SQL database in my first job. I have co worked with senior software developers of Microsoft. I was a member of team wh Mais

₹400 INR / hora
(7 Comentários)

Hi, i can do your job [login to view URL] chat 1. 10 Years of experience 2. Expert in ASP.net,C#.net,VB.net,Sql server,MySql,MS Access,Crystal Report 3. Worked in almost 150 projects. 4. Dedication,timely execution and perfecti Mais

₹400 INR / hora
(21 Comentários)

Hi, I hope you are doing well I am a professional on SQL server, VBA programming, MS access and also in power BI. I am doing this job since 2010.I can handle your project in a very prudent manner. As per your requirem Mais

₹1400 INR / hora
(6 Comentários)

Hi, I have read your full project description and understood the problem. I'm confident enough that I can solve this issue for you.. I would like to discuss more with you in chat. Please message me so we can discuss fu Mais

₹250 INR / hora
(7 Comentários)

Hi there, I am Kapil Purohit. I have been exploring Software,Web & Mobile Development for 10 long years and still interested in carrying myself on with gaining unlimited knowledge from it. As I have always been an i Mais

₹350 INR / hora
(2 Comentários)

Hello It's a piece of cake if you are working on .netframework. Let talk to help you You are wellcome

₹400 INR / hora
(2 Comentários)

I have experienced in web and windows applications development using c# and vb.net. so if you want to assign this task, I will complete this.

₹350 INR / hora
(0 Comentários)

I have a love of Web Development and IT in general that I bring to all my work. I am meticulous and am always learning more about my field to both stay current and to expand on my skills. I have about 6 years of experi Mais

₹250 INR / hora
(0 Comentários)

Give it to me, i'm will sloved it. I have experienced in windows applications development using c# and vb.net. so if you want to assign this task, I will complete this

₹300 INR / hora
(0 Comentários)