Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 25th, 2007, 02:19 AM
Registered User
 
Join Date: Jun 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to prrao
Default errror connecting to database


i was doing a code which connects to northwind database

Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Windows.Forms;

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            string source = "server =(local);" + "integrated security =SSPI;" + "database=NorthWind";
            SqlConnection conn = new SqlConnection(source);
            conn.Open();
            MessageBox.Show("hello");
            conn.Close();

        }
    }
}

i was getting a strange error message in vs2005
error:


Code:
Error    1    The type 'System.Data.SqlClient.SqlConnection' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll' and 'c:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies\System.Data.SqlClient.dll'    C:\Documents and Settings\admin\My Documents\Visual Studio 2005\Projects\ConsoleApplication4\ConsoleApplication4\Program.cs    14    13    ConsoleApplication4
can anyone plz help me in debugging program.
(profeesional c#2005, chap 19,pg 583)

thanks

prrao
 
Old June 25th, 2007, 05:14 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

It would appear that you have a reference to several assemblies that contain the same class definition. You may need to remove some assembly references from your project.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
connecting to database stealthdevil Visual Basic 2005 Basics 2 November 5th, 2007 01:31 PM
Connecting to a database mfos Classic ASP Basics 0 December 20th, 2006 07:59 AM
connecting to a database nehalw VB.NET 0 January 5th, 2005 05:59 AM
OpenReport Action Cancelled errror in Access 2003 JJ Access VBA 1 August 20th, 2004 09:27 AM
database connecting princeofdhump Classic ASP Databases 3 August 7th, 2004 02:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.