axum Posted April 4, 2003 Posted April 4, 2003 Ok i have this at the top of my page : private SqlConnection sqlConn = new SqlConnection(); and i have a createDBConnection function, that gets called a lot. How do i write this line : If sqlConn Is Nothing Then 'create connection end if but in C#??? How do i check if sqlConn is set to anything yet?? HELP!! Axum Quote
*Experts* Volte Posted April 4, 2003 *Experts* Posted April 4, 2003 if (sqlConn == null) { /* create connection */ } Quote
axum Posted April 4, 2003 Author Posted April 4, 2003 hehe, ok... i have this: if (sqlConn == null) { string strDbConn; strDbConn = "Integrated Security=True;Data Source=local;Initial Catalog=Taxonomy;"; sqlConn = new SqlConnection(strDbConn); } but now when i run it, the string never gets run? then when i try and fill my Dataset it says missing connectionString property??! Quote
*Experts* Volte Posted April 4, 2003 *Experts* Posted April 4, 2003 Then are you sure that your sqlConn is indeed null? Try setting the declaration line of 'sqlConn' toSqlConnection sqlConn = null; Quote
axum Posted April 4, 2003 Author Posted April 4, 2003 well it's within an ASP.NET code-behind page, so it gets run once, then gets run on every postback.... i think i may just leave it out!! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.