Fermé

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

Next

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]

fillChkboxListSub()

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

Compétences : Serveur SQL Microsoft, SQL, .NET, VB.NET

En voir plus : 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

Concernant l'employeur :
( 0 commentaires ) New Delhi, India

Nº du projet : #31567382

10 freelances font une offre moyenne de 443 ₹/heure pour ce travail

anandan1995

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 Plus

₹333 INR / heure
(34 Commentaires)
4.8
sefakemal

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 Plus

₹400 INR / heure
(7 Commentaires)
3.9
bbbssolutions

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 Plus

₹400 INR / heure
(21 Commentaires)
3.7
VBAautomation

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 Plus

₹1400 INR / heure
(6 Commentaires)
3.8
tbhlabib1

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 Plus

₹250 INR / heure
(7 Commentaires)
3.2
Kapilpurohitt

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 Plus

₹350 INR / heure
(2 Commentaires)
2.4
agustinavilac

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

₹400 INR / heure
(2 Commentaires)
1.6
ramvilas143

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 / heure
(0 Commentaires)
0.0
Estelio

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 Plus

₹250 INR / heure
(0 Commentaires)
0.0
mrsiro999

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 / heure
(0 Commentaires)
0.0