Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Still Can't Figure This Out
Message
 
To
11/10/2004 20:52:14
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00950462
Message ID:
00950688
Views:
16
Bonnie,

You're right. I found a sample Connection Implementation in the docs, and thats
when I realized the book code showed Functions, not properties.

The code I psated in is wrong. And it's exactly as it is in the book.

I also found a typo 2 pages later. I'm going to go to Hentzenwerke and look
for errata for the book.

Once I fixed the interface, it compiled fine.

Thanks for hanging in there with me!



>Kevin,
>
>>'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.

>
>Yes, but ConnectionString is a property, not a function (or method). Different animals.
>
>>There is a blue wavy line under System.Data.IDbConnection
>
>Not sure why it would do that here, could be something funky with your VB code maybe (I can never remember the proper syntax for VB stuff). Have you hovered your mouse over the wavy lines? It'll tell you what the problem is.
>
>~~Bonnie
>
>
>>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.IDbConnection
>>
>>Does this mean that the system does not recognise the text?
>>
>>I have re-pasted my code:
>>
>>
>>
>>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(ByVal DatabaseName As String) _
>>        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
>>
>>    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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform