P
priyanka.freakout
Hi All,
In my form I have created a dropdown box which is populated with data
from a database on page load and i have also created a dropdwon box and
what i intend on doing is displaying data re;ated to dropdown selection
into a data grid.
I have attached part of the code.
Can someone please help me out on this cos i am really finding it
difficult doing it with the data reader.
Public Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
Dim str As String
Dim sqlstr As String
Dim ds As DataSet
Dim ds1 As New DataSet
Dim sqlcmd As New SqlClient.SqlCommand
Dim dataadp As New SqlClient.SqlDataAdapter
SqlConnection1.Open()
str = DropDownList1.SelectedItem.Text
Label1.Text = str
sqlstr = "select * from Resources where Module_name=" + str
Label3.Text = sqlstr
sqlcmd = New SqlClient.SqlCommand(sqlstr, SqlConnection1)
dataadp = New SqlClient.SqlDataAdapter(sqlcmd)
dataadp.SelectCommand.Connection = SqlConnection1
SqlCommand1.CommandText = sqlstr
SqlCommand1.ExecuteReader()
In my form I have created a dropdown box which is populated with data
from a database on page load and i have also created a dropdwon box and
what i intend on doing is displaying data re;ated to dropdown selection
into a data grid.
I have attached part of the code.
Can someone please help me out on this cos i am really finding it
difficult doing it with the data reader.
Public Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
Dim str As String
Dim sqlstr As String
Dim ds As DataSet
Dim ds1 As New DataSet
Dim sqlcmd As New SqlClient.SqlCommand
Dim dataadp As New SqlClient.SqlDataAdapter
SqlConnection1.Open()
str = DropDownList1.SelectedItem.Text
Label1.Text = str
sqlstr = "select * from Resources where Module_name=" + str
Label3.Text = sqlstr
sqlcmd = New SqlClient.SqlCommand(sqlstr, SqlConnection1)
dataadp = New SqlClient.SqlDataAdapter(sqlcmd)
dataadp.SelectCommand.Connection = SqlConnection1
SqlCommand1.CommandText = sqlstr
SqlCommand1.ExecuteReader()