i have one combobox and it is containing some items when ever i changed that item the output is generated according that it means i store databases in my combobox the default item is "select" like this
I have so many forms when ever i changed my cbdatabaselist that database is coming this code is in master page
sqlConn = New SqlConnection(strConn)
sqlConn.Open()
Dim sqlds1 As New DataSet
Dim sqlda1 As SqlClient.SqlDataAdapter
Dim sqlds1 As New DataSet
sqlQry = "EXEC sp_databases"
sqlda1 = New SqlDataAdapter(sqlQry, sqlConn)
sqlda1.Fill(sqlds1, "DataBaseList")
sqlConn.Close()
Session.Add("dscb", " ")
Session.Add("dscb", sqlds1.Tables("DataBaseList"))
Dim IntPCount As Integer
IntPCount = sqlds1.Tables("DataBaseList").Rows.Count
Dim PCol As String
cbDataBaseList.Items.Clear()
cbDataBaseList.Text = "Select"
For p = 0 To IntPCount - 1
PCol = sqlds1.Tables("DataBaseList").Rows(p).Item("DATABASE_NAME").ToString
If PCol.Length > 5 Then
If PCol <> "master" Or PCol <> "msdb" Or PCol <> "tempdb" Then
Dim strDataBaseName As String = PCol
strDataBaseName = strDataBaseName.Remove(4)
'*** Add only "Customer's" which got the prefix "CLT_ " ***
If strDataBaseName = "CLT_" Then
Dim NewPCol As String = PCol.Replace("CLT_", "")
NewPCol.Trim()
cbDataBaseList.Items.Add(NewPCol)
End If
End If
End If
Next
sqlds1.Dispose()
Catch ex As Exception
strex = ex.Message