Link to home
Start Free TrialLog in
Avatar of Cained
Cained

asked on

Access table size in VB.net

Hi

I am trying to find out the size of a Microsoft Access Table in VB. I am using the following code.


        Dim cnn2 As OleDbConnection = New OleDbConnection()
        Dim cmd As OleDbCommand = New OleDbCommand()
        cnn2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\server\file\News.mdb"
        cmd.CommandText = "select count(*) as c1 from Headline"

        cmd.CommandType = CommandType.Text
        cnn2.Open()
        newrow = cmd.ExecuteNonQuery()


and getting the following error

System.InvalidOperationException: ExecuteNonQuery: Connection property has not been initialized.

Is there another way of doing this or am I on the right lines
ASKER CERTIFIED SOLUTION
Avatar of Arthur_Wood
Arthur_Wood
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial