Click here to Skip to main content
16,020,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have 1 table name fullsort. in that all records are there.

i have 1 form where i have taken 1 combobox. and on selection of any name from combobox,the data related to that name will display it in datagridview

please kindly help.

thanks in advance
Posted
Comments
sudeshna from bangkok 12-Jul-13 5:00am    
Public Class Form5

Dim cn As New SqlConnection("Data Source=.\INSTANCE;initial catalog=record;user=sa;password=gariahat")
Dim da As New SqlDataAdapter
Dim cmd As New SqlCommand
'Dim dr As New SqlDataReader
Dim dt1 As DataTable
Dim ds As New DataSet
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'RecordDataSet.fullsort' table. You can move, or remove it, as needed.
Me.FullsortTableAdapter.Fill(Me.RecordDataSet.fullsort)
'TODO: This line of code loads data into the 'RecordDataSet.finalsort' table. You can move, or remove it, as needed.
' Me.FinalsortTableAdapter.Fill(Me.RecordDataSet.finalsort)
'datasearch()


End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub




Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim cn As New SqlConnection("Data Source=.\INSTANCE;initial catalog=record;user=sa;password=gariahat")
cn.Open()
Dim da As New SqlDataAdapter("Select * from fullsort where name='" & ComboBox1.SelectedText & "'", cn)
Dim ds As New DataSet()
dt1 = New DataTable
da.Fill(dt1)
FullsortDataGridView.DataSource = dt1

FullsortDataGridView.Refresh()
cn.Close()

End Sub
ZurdoDev 12-Jul-13 12:12pm    
Please use the improve question link and add the code to the post.
sudeshna from bangkok 12-Jul-13 5:02am    
even i have tried using with databind,but not working.

this is the last form and if i do not finish,my project wont end.

please kindly help all the experts.
ZurdoDev 12-Jul-13 12:12pm    
It's hard to tell where you are stuck.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900