|
-
Sep 24th, 2008, 08:33 AM
#1
Thread Starter
New Member
[2005] 'Type Expected' Error
Hi
Wondering if anyone can help me with a very strange problem I'm experiencing. The following line of code is stopping my application from compiling with the error "Type Expected"
The offending line of code is
Dim rData As New Data
I have included the correct Import statements i.e
Imports System.Data
Imports System.Data.SqlClient
and have even tried re-adding System.Data as a reference and putting the dll directly into me bin directory but my project simply refuses to recognise it as a valid type. Needless to say I'm pulling my hair out trying to figure out what's going on here. Am I missing something obvious or is this some thing anyone has experienced before.
Any help would be greatly appreciated.
Thanks in advance.
-
Sep 24th, 2008, 08:38 AM
#2
Re: [2005] 'Type Expected' Error
System.Data is a namespace and not a type, therefor you can not declare a variable as such.
-
Sep 24th, 2008, 09:36 AM
#3
Re: [2005] 'Type Expected' Error
As Atheist says. You must mean DataSet, or DataTable, or DataRow or something like that.
-
Sep 24th, 2008, 10:48 AM
#4
Thread Starter
New Member
Re: [2005] 'Type Expected' Error
Hi
Thanks for the reply - You're absolutely correct on closer examination the Intellisense is indeed providing the namespace Data as the only choice (and of course I cannot declare a variable to a Namespace with the above code)
However here's where things get more confusing: this project was developed on a server where (surprisingly it runs fine). If I type this line of code on the server then the Intellisense actually presents me with a class and not a Namespace - so there does seem to be something strange going on. We need to move this code to another box so I do need to find a solution to this. I'm presently checking all the references contained in the project and their version numbers to see in there are any differences.
Any more thoughts on what might be causing this would be most welcome.
-
Sep 24th, 2008, 10:51 AM
#5
Re: [2005] 'Type Expected' Error
The project you're writing on the server must have imported some namespaces that you have not imported in your current project.
-
Sep 24th, 2008, 05:59 PM
#6
Re: [2005] 'Type Expected' Error
The System namespace is imported into all VB projects by default, giving you unqualified access to its child Data namespace. I believe that all VB projects also import the System.Data namespace by default too. Certainly WinForms projects do, giving you unqualified access to the members of that namespace. You can always check which namespaces are imported into your project on the References tab of the project properties.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|