Oops, I forgot the param.
As far as the implemenation, when I complile I get:
'ConnectionString' cannot implement 'ConnectionString' because there is no matching function on interface 'IDbConnection'.
Not sure why this is. I checked the interface, and ConnetionString is a member.
In my code, on the lines that are propertiesm there are blue wavy lines
under the implemented name:
There is a blue wavy line under
System.Data.IDbConnectionDoes this mean that the system does not recognise the text?
I have re-pasted my code:
Public Class VfpConnection
Implements System.Data.IDbConnection
Public Function ConnectionString() As String() _
Implements IDbConnection.ConnectionString
Return Nothing
End Function
Public Function ConnectionTimeOut() As String() _
Implements IDbConnection.ConnectionTimeOut
Return Nothing
End Function
Public Function Database() As String() _
Implements IDbConnection.Database
Return Nothing
End Function
Public Function State() As String() _
Implements IDbConnection.State
Return Nothing
End Function
Public Overloads Function BeginTransaction() As IDbTransaction _
Implements IDbConnection.BeginTransaction
Return Nothing
End Function
Public Overloads Function BeginTransaction(ByVal level As System.Data.IsolationLevel) _
As IDbTransaction _
Implements IDbConnection.BeginTransaction
Return Nothing
End Function
Public Sub ChangeDatabase(ByVal DatabaseName As String) _
Implements IDbConnection.ChangeDatabase
End Sub
Public Sub Close() _
Implements IDbConnection.Close
End Sub
Public Function CreateCommand() As IDbCommand _
Implements IDbConnection.CreateCommand
Return Nothing
End Function
Public Sub Open() _
Implements IDbConnection.Open
End Sub
Public Property ConnectionString() As String Implements System.Data.IDbConnection.ConnectionString
Get
End Get
Set(ByVal Value As String)
End Set
End Property
Public ReadOnly Property ConnectionTimeout() As Integer Implements System.Data.IDbConnection.ConnectionTimeout
Get
End Get
End Property
Public ReadOnly Property Database() As String Implements System.Data.IDbConnection.Database
Get
End Get
End Property
Public ReadOnly Property State() As System.Data.ConnectionState Implements System.Data.IDbConnection.State
Get
End Get
End Property
Public Sub Dispose() Implements System.IDisposable.Dispose
End Sub
End Class 'VfpConnection
>Kevin,
>
>If you look at the docs for IDBConnection, you'll see that the ChangeDatabase() method requires a parameter and you have no paramter in your method. I don't know if it's a typo on your part, or in the book, but fix that (and also implement the property that you're erroring on, ConnectionString) and you should be good to go.
>
>~~Bonnie
>
>
>
>>I have Kevin McNeish' book '.Net for Visual FoxPro Developers' and I typed in the
>>code on page 141 (pasted below) into a VB class.
>>
>>When I compile, I get the following errors:
>>'ChangeDatabase' cannot implement 'ChangeDatabase' because there is no matching sub on interface 'IDbConnection'.
>>'ConnectionString' cannot implement 'ConnectionString'...
>>'ConnectionTimeOut' cannot implement 'ConnectionTimeOut'...
>>'State' cannot implement 'State'...
>>
>>and 5 more like this:
>>
>>'VfpConnection.VfpConnection' must implement 'Overridable Property ConnectionString() As String' for interface 'System.Data.IDbConnection'. Implementing property must have matching 'ReadOnly'/'WriteOnly' specifiers.
>>
>>
>>What am I doing wrong?
>>
>>
>>
>>
>>Public Class VfpConnection
>>
>> Implements System.Data.IDbConnection
>>
>> ' Properties
>> Public Function ConnectionString() As String() _
>> Implements IDbConnection.ConnectionString
>> ' Place code here
>> Return Nothing
>> End Function
>>
>> Public Function ConnectionTimeOut() As String() _
>> Implements IDbConnection.ConnectionTimeOut
>> ' Place code here
>> Return Nothing
>> End Function
>>
>> Public Function Database() As String() _
>> Implements IDbConnection.Database
>> ' Place code here
>> Return Nothing
>> End Function
>>
>> Public Function State() As String() _
>> Implements IDbConnection.State
>> ' Place code here
>> Return Nothing
>> End Function
>>
>> Public Overloads Function BeginTransaction() As IDbTransaction _
>> Implements IDbConnection.BeginTransaction
>> ' Place code here
>> Return Nothing
>> End Function
>>
>> Public Overloads Function BeginTransaction(ByVal level As System.Data.IsolationLevel) _
>> As IDbTransaction _
>> Implements IDbConnection.BeginTransaction
>> ' Place code here
>> Return Nothing
>> End Function
>>
>> Public Sub ChangeDatabase() _
>> Implements IDbConnection.ChangeDatabase
>> ' Place code here
>> End Sub
>>
>> Public Sub Close() _
>> Implements IDbConnection.Close
>> End Sub
>>
>> Public Function CreateCommand() As IDbCommand _
>> Implements IDbConnection.CreateCommand
>> ' Place code here
>> Return Nothing
>> End Function
>>
>> Public Sub Open() _
>> Implements IDbConnection.Open
>> ' Place code here
>> End Sub
>>
>>End Class 'VfpConnection
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people