?
Solved

Simple Data Connection Issute

Posted on 2007-04-03
2
Medium Priority
?
209 Views
Last Modified: 2010-05-18
What is wrong with the below - I am getting the following: Value of type 'System.Data.SqlClient.SqlConnection' cannot be converted to '1-dimensional array of System.Data.SqlClient.SqlConnection'. at this line: GetConnection = ret_conn
   

Protected Function GetConnection() As SqlConnection()

        Dim ret_conn As SqlConnection

        If mCN = String.Empty Then
            ret_conn = New SqlConnection(ConfigurationManager.ConnectionStrings("cn_catteam_dev").ConnectionString) 'Use Default
        Else
            ret_conn = New SqlConnection(mCN)
        End If

        ret_conn.Open()
        GetConnection = ret_conn

    End Function
0
Comment
Question by:tbaseflug
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
mem99999 earned 1200 total points
ID: 18843981
Try to remove () at first line

Protected Function GetConnection() As SqlConnection

        Dim ret_conn As SqlConnection

        If mCN = String.Empty Then
            ret_conn = New SqlConnection(ConfigurationManager.ConnectionStrings("cn_catteam_dev").ConnectionString) 'Use Default
        Else
            ret_conn = New SqlConnection(mCN)
        End If

        ret_conn.Open()
        GetConnection = ret_conn

    End Function
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 800 total points
ID: 18843991
Try this instead:
   Protected Function GetConnection() As SqlConnection

When you use empty parentheses at the end of a type, it denotes an array.

Bob
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month12 days, 13 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question