Problems with references

L

larclap

The following code snippet has reference errors:

Imports System
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient

Public Class DataSourceDB

Private _Descr, _CsvFileName, _XSLTransform As SqlString
Private _dsID, _errorCode As SqlInt32
Private _mainConnection As SqlConnection
Private _rowsAffected As Int32

Public Sub New()
_mainConnection = New SqlConnection
_mainConnection.ConnectionString = cnString
End Sub

The first error says:
Namespace or type specified in the Imports 'System.Data.SqlTypes'
doesn't contain any public member or cannot be found. Make sure the
namespace or the type is defined and contains at least one public
member. Make sure the imported element name doesn't use any aliases.

However, when I try to add a reference to the project,
System.Data.Sqltypes is not a choice in the .NET tab.

The datatype SqlConnection has the following error:
Reference required to assembly 'System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes'
containing the base class 'System.ComponentModel.Component'. Add one to
your project.

But there already is a reference to System in the project!

What am I missing here?

TIA, Lars
 
R

RobinS

Which version of the .Net framework are you running? I took your code and
copied it and pasted it into a new class in VS2005, and it worked fine. I'm
using .Net 2.0.

Also, what version of SQLServer are you using?

Robin
 
L

larclap

Robin,

I'm using .Net 2.0 with SQL Server 2005.
Which version of the .Net framework are you running? I took your code and
copied it and pasted it into a new class in VS2005, and it worked fine. I'm
using .Net 2.0.

Also, what version of SQLServer are you using?

Robin
 
R

RobinS

Weird. This is my System.Data dll location and file name. Do you have the
same thing? I think System.Data.SqlTypes is included in the System.Data.dll.
Mine is dated 9/23/2005 7:28 AM.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll

Also, I assume you're using VS2005? yes?

If you bring up the Object Browser in VS2005 and look under System.Data, do
you see System.Data.SqlTypes there?

Robin
 
L

larclap

Yes, the file is there - System.Data.dll 2.0.50727.42 9/23/2005 6:28AM
I am using VS2005
And I can see System.Data.Sqltypes beneath System.Data in the Object
Browser!
 
L

larclap

Yes, the file is there - System.Data.dll 2.0.50727.42 9/23/2005 6:28AM
I am using VS2005
And I can see System.Data.Sqltypes beneath System.Data in the Object
Browser!
 
R

RobinS

Does the error happen at runtime, or when you Build?

What does your connection string look like?

Robin
 
R

RobinS

I got an e-mail from "larclap". He talked to MSFT;
his project file was corrupted. I presume that
fixed the problem.

Robin S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top