hi, iam having 2 listboxes.In one listbox i am populating products from Msacess.Then after clicking any of the product it should populate corresponding schedules in the other listbox.Below is my code Kindly reply me as soon as possible..
Dim sql As String
con = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;Data Source=D:\Inetpub\wwwroot\WebApplication12\WRMdatabase.mdb")
sql = "select distinct scheduleid from die1 where productid =' " & ListBox1.SelectedItem.Value & " ' "
Response.Write(sql)
cmd = New OleDbCommand(sql, con)
con.Open()
reader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
' ListBox2.DataValueField = "ScheduleId"
While reader.Read
ListBox2.Items.Add(reader(0))
End While
ListBox2.Items.Clear()
ListBox2.DataSource = reader
ListBox2.DataBind()
reader.Close()