Using MS Access to Generate SQL

JesseH

Active member
Joined
Feb 9, 2006
Messages
42
Location
Sugar Land, TX
Programming Experience
10+
I am trying to generate the SQL in Access using SQL View and copying it into VB.net. Has someone out there tried this? I get errors when I do this. Can anybody give my any hints on how to accomplish this?

Thanks for the help
 
Actually, I have solved that. Access uses underscore between file name and field name and VB uses period. The problem I am now having is getting -An unhandled exception of type 'System.NullReferenceException' occurred in EIMReconStart.exe. I have no clue how to fix. Can you help?
 
How much do you know about object orientation?

You know the difference between these two statements:

Dim s as String
Dim t as New String



only one of them is set to a value, the other is set to null.

Calling s.Length will cause a NullReferenceException because s is null - its a pointer but it points to nothing. No object.


Read the error message and what line it occurs on. Something on that line is Nothing (pointing to nothing) when it needs to be pointing to something
 
Well, you dont specifically learn VB.NET - It's more like you learn .NET as a language, and the syntax resembles VB. An analogy may be that .NET is English and the flavours (vb, c#) are regional dialects; subtle differences that initially make it hard to understand what you dont know.. But eventually you can understand them all :)

If youre new to the notions of object orientation then you should focus on understanding that, as a concept
 
How much do you know about object orientation?

You know the difference between these two statements:

Dim s as String
Dim t as New String

only one of them is set to a value, the other is set to null.

@cjard - just an aside
Did you know there is another subtle difference: using the New keyword when declaring a type (as opposed to a class) forces it to be boxed as an object and allocated to the heap rather than the stack. This generates additional work for the CLR, unboxing and boxing, every time the variable is used - so this technique should not be used without good reason.
 
I'd never heard of this and I havent so far found any articles discussing this behaviour.

The boxing operation you describe does indeed occur when running with Option Explicit and Strict turned off, thereby allowing vairables to be used without being declared, but I'd never program in such a fashion as I consider it weak and error prone.
http://www.eggheadcafe.com/articles/20020427.asp

Can you refer me to an example of an article that explores the differences between
Dim x as New String
Dim x as String = New String

in the way you suggest here (that one is boxed as object and one is not)?

i.e. Do you suggest that the top call is rewritten:
Dim x as Object = New String


?
 
This is interesting... I would love to know where you aquired this information Gruntie776. You talk about types and classes like they are different things, do you mean Value Types/Reference types. Classes are reference types for example? Maybe strings here are not the best example as they are immutable in vb.net. As for where a type is allocated, it depends on it's type again Reference/Value. As far as i am aware there is no boxing happening unless you do something like the following..

VB.NET:
Dim A

Which would be assigned the type of object by default. Where as for example..

VB.NET:
Dim A As ListBox
 
or 
 
Dim A As New ListBox

No boxing occurs here in regards to the reference type. As is the same for value types.
 
I was referring to Value / Reference types. I am trying to find my source as we speak - I have looked it up elsewhere though and have been given a different answer. So it is entirely possible I have been mislead. I'll post an answer up soon.
 
Well I have looked for that article everywhere but I cannot find it. I guess I have either been misled or I have put 2+2 together and got 5.

I can confirm that the stated function of the NEW keyword is to instanciate the supplied type on the Heap. However (as I know know) if the supplied type is a value type the CLR steps in and transparently creates it on the stack.

Sorry for the mixup
 
Back
Top