Hi,
Where this piece of code is located?
Are you getting any exception?
Set the debugger to "break on exception" to see if you are getting some
exception
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Hrcko" <hr*********@luatech.com> wrote in message
news:dk**********@ss405.t-com.hr...
I put a variable active after ExecuteNonQuery, but it closes when Execute
NonQuery is finished.
Hrcko
Richard Blewett [DevelopMentor] wrote: "Hrcko" <hr*********@luatech.com> wrote in message
news:dk**********@ss405.t-com.hr...
int active = 0;
conn = new SqlConnection (sConn);
conn.Open() ;
SqlCommand sc = new SqlCommand ("LogoActiveCheck",conn);
sc.CommandType = CommandType.StoredProcedure;
sc.Parameters.Add (
new SqlParameter ("@RowCount",ParameterDirection.ReturnValue));
sc.ExecuteNonQuery();
sc.Connection.Close ();
active = (int)sc.Parameters["@RowCount"].Value;
I'm using this code to get @rowcount, but when it finishes form closes.
Why?
Hrcko
You need to keep the connection open until you have read the parameter.
You are getting an exception which is ending up terminating the app
Regards
Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk