MonoBASIC and ADO.NET was RE: [Mono-list] mBas now understands rootnamespace

A Rafael D Teixeira rafaelteixeirabr@hotmail.com
Tue, 04 Feb 2003 00:12:17 -0200


This slightly altered source, compiles and runs up to point it tries the 
connection:

<mbas savedAs="mcs/mbas/testmbas/ado.vb">
Imports System
Imports System.Data
Imports System.Data.SqlClient

Module Module1

    Sub Main()
        Dim con As SqlConnection
        Dim cmd As SqlCommand
        Dim reader As SqlDataReader
        Dim firstName As String

        con = New SqlConnection("Server=localhost;database=pubs;user
id=someuser;password=somepass")
        con.Open()
        cmd = con.CreateCommand()
        cmd.CommandText = "select fname from employee"
        reader = cmd.ExecuteReader()
        If (reader.Read()) Then
            firstName = reader.GetString(0)
            Console.WriteLine(firstName)
        Else
            Console.WriteLine("No data returned.")
        End If
    End Sub

End Module
</mbas>

Then as expected gives:

Unhandled Exception: System.Net.Sockets.SocketException: Connection Refused
...
System.Net.Sockets.Socket:Connect(System.Net.EndPoint)
...

Happy Hackings,


Rafael Teixeira
Brazilian Polymath
Mono, MonoQLE Hacker




_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail