my code is:
<pre>
If IsNumeric(txtID.Text) = True And txtID.Text <> Nothing Then
Dim com As New SqlCommand("Select * from Employees where EmpID=" CInt(txtID.Text) "", con)
Try
con.Open()
Dr3 = com.ExecuteReader
While Dr3.Read()
txtID.Text = Dr3.Item(0)
txtName.Text = Dr3.Item(1)
txtDOP.Text = Dr3.Item(2)
txtPhone.Text = Dr3.Item(3)
txtEmail.Text = Dr3.Item(4)
Session("SecID") = CInt(Dr3.Item(5))
Session("DepID") = CInt(Dr3.Item(6))
Session("SectID") = CInt(Dr3.Item(7))
Dr3.Close()
con.Close()
con.Open()
Dim SecItem As New SqlCommand("select SecName from sectores where SecID=" Session("SecID") "", con)
Dr4 = SecItem.ExecuteReader()
While Dr4.Read()
DropDownSec.SelectedValue = Dr4.Item(0)
End While
Dr4.Close()
con.Close()
con.Open()
Dim DepItem As New SqlCommand("select DepName from Departments where DepID=" Session("DepID") "", con)
Dr5 = DepItem.ExecuteReader()
While Dr5.Read()
DropDownDep.SelectedValue = Dr5.Item(0)
End While
Dr5.Close()
con.Close()
con.Open()
Dim SectItem As New SqlCommand("select SectName from Sections where SectID=" & Session("SectID") "", con)
Dr6 = SectItem.ExecuteReader()
While Dr6.Read()
DropDownSect.SelectedValue = Dr6.Item(0)
End While
Dr6.Close()
con.Close()
End While
Catch
Label1.Text = "Invalid ID"
End Try
Else
Label1.Text = "Required To Enter Number "
End If
</pre>
connection String:
Dim con As New SqlConnection(ConfigurationManager.ConnectionStrings("WebApplicationConnectionString").ConnectionString)
and in Web.Config:
<code><pre lang="xml"><connectionStrings>
<add name="WebApplicationConnectionString" connectionString="Data Source=MALAHMAD-PC\SQLEXPRESS;Initial Catalog=WebApplication;Integrated Security=True;<b>MultipleActiveResultSets=True</b>" providerName="System.Data.SqlClient"/>
</connectionStrings></pre>
</code>
when run this code, Dr5 and the rest of try code dose not Execute and execute Catch code !!!!!!
i'm realy want to know,, what is the problem? why he go to catch code?
Plz if any one have any idea tell me...
regardes