My application needs to get data from a store procedure. In a query program the stored procedure works fine;
exec MyStoredProdure @Prama1 = '01'
In WPF it times out. Here is my code;
using (SqlConnection con = new SqlConnection(ConString))
{
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Prama1", "01");
cmd.CommandText = "MyStoredProdure";
cmd.Connection = con;
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable("MyStoredProdure");
sda.Fill(dt);
foreach (DataRow dr in dt.Rows)
{
//Do code
}
con.Close();
}
It is timing out right on sda.Fill(dt)
. It should be noted that Select and inserts work perfectly fine.