in vb, I use this to open a connection:
That ensures that a connection is closed beforehand. In c#, I'm trying the same:VB Code:
Public Sub Connect(ByVal db As SqlClient.SqlConnection) 'Overloaded 'This is for a sqlConnection 'Kill the connection if it is open 'Then open the connection KillConnection(db) db.Open() End Sub Public Sub KillConnection(ByVal DB As SqlClient.SqlConnection) If DB.State <> ConnectionState.Closed Then DB.Close() End If End Sub
I'm getting build errors on the db.Open part.PHP Code:public void Connect(SqlConnection db)
{
KillConnection(db);
db.Open;
}
public void KillConnection(SqlConnection db)
{
if (db.State !=System.Data.ConnectionState.Closed)
{
db.Open;
}
}
A couple of questions pop up for me. First, of course, is how do I get this to work?!Second, does this have something to do with the fact that Option Strict is on in C#? I know C# is more of a stronger typed language and I actually expected something like this to happen.




Second, does this have something to do with the fact that Option Strict is on in C#? I know C# is more of a stronger typed language and I actually expected something like this to happen.
Reply With Quote