473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Checking db connection for initialising

Hi

I am passing an sqlconnection optional parameter as below;

Optional ByVal DBConn As SqlClient.SqlConnection = Nothing

I have given it an initial value of nothing howee rwhe I try to test for
nothing like;

If DBConn = Nothing

I get an 'Operator '=' is not defined for types
'System.Data.SqlClient.SqlConnection' and
'System.Data.SqlClient.SqlConnection' error. What am I missing and how can I
check if a value was in fact passed for the optional parameter DBConn?

Thanks

Regards
Jun 27 '08 #1
2 1181
On Jun 6, 5:04 am, "John" <i...@nospam.infovis.co.ukwrote:
Hi

I am passing an sqlconnection optional parameter as below;

Optional ByVal DBConn As SqlClient.SqlConnection = Nothing

I have given it an initial value of nothing howee rwhe I try to test for
nothing like;

If DBConn = Nothing

I get an 'Operator '=' is not defined for types
'System.Data.SqlClient.SqlConnection' and
'System.Data.SqlClient.SqlConnection' error. What am I missing and how can I
check if a value was in fact passed for the optional parameter DBConn?

Thanks

Regards
*sigh*

You should uninstall Visual Studio and shut down your computer and
leave it that way. The solution to this problem can only be found by
having at least one of two important skills, which judging from this
and previous posts it seems you are lacking both:

1) Understanding basic programming
2) Being able to use Google

But just for kicks, I'll copy and paste your error message into Google
and give you the link:

http://www.google.com/search?hl=en&q...=Google+Search

Top link being the following which clearly answers your question:

http://msdn.microsoft.com/en-us/libr...tw(VS.80).aspx

Thanks,

Seth Rowe [MVP]
Jun 27 '08 #2
Seth's sarcastic answer aside (he seems to have forgotten that newsgroups
aren't just for experienced programmers),

The equal sign (=) can't be used to check if something is nothing, instead
you use the actual keyword "is".

If DBConn Is Nothing Then...

-Scott

"John" <in**@nospam.infovis.co.ukwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Hi

I am passing an sqlconnection optional parameter as below;

Optional ByVal DBConn As SqlClient.SqlConnection = Nothing

I have given it an initial value of nothing howee rwhe I try to test for
nothing like;

If DBConn = Nothing

I get an 'Operator '=' is not defined for types
'System.Data.SqlClient.SqlConnection' and
'System.Data.SqlClient.SqlConnection' error. What am I missing and how can
I check if a value was in fact passed for the optional parameter DBConn?

Thanks

Regards

Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steven Scaife | last post by:
Below is my ASP page, I have changed the update to read DRIAL which doesn't exist, shouldnt this throw an error, or if the connection cannot be made shouldnt it throw an error as well thanks in...
8
by: Nick Keighley | last post by:
Hi, is there a way of initialising a vector in a similar fashion to initialising an array? consider: Shape* triangle = new Triangle (); Shape* square = new Square (); Shape* shape_arr =...
17
by: Christopher Benson-Manica | last post by:
All right, since my previous idea (calling functions through a wrapper) was apparently so awful no one could suggest any improvements, I'll try a different tack. My end goal is to make detecting...
99
by: Mikhail Teterin | last post by:
Hello! Consider the following simple accessor function: typedef struct { int i; char name; } MY_TYPE; const char *
2
by: Venkata Narayana | last post by:
Hi, You all may be knowing that Connection.isClosed() does not tells us if the underying DB connection is active or not; it only checks if Connection.close() had been previously called or not....
107
by: DaveC | last post by:
I always used to initialise variables at declaration, then a couple of colleagues started telling me it was bad practice and that the compiler should be left to spot the use of uninitilised...
2
by: Mike | last post by:
Hello, Ok I have 2 classes in my project, one is the main form and one is a connection class, at a certain event on my main form a new instance is made of the connection class, and a reference...
8
by: John | last post by:
Hi I am creating a db connection using the below code. Is there a way to check if the connection is open? Thanks Regards
4
by: mask | last post by:
I wish to connect to Oracle thru VB6 using ADO, test connection fails and the error which comes is as Test Connection failed because of error in initialising provider-oracle client and networking...
2
by: hakkatil | last post by:
Hi to all, I have a page that inserts excel sheet to access database. I am using asp. What I want to do is to check the inserting record if it is in the database. Basicly checking the dublicate...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.