By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,665 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

What is this error about? Hope I'm posting at the right place..

P: n/a
Tim
Hi, I'm kinda new to Dot Net in general and I'm trying to see if I can
get some Connection stuff in a mesage box.. Well, I tried this code and
I get an error that says " Type SQL Connection is not Defined" .. I have
the System.Data reference in solution explorer, but I'm not sure what
references I need? Maybe that isn't the problem, and if not, can someone
tell me what it is?

Thanks in advance
Tim

Code: ----------------------------------------------------------------------

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim myConnection As New SqlConnection
myConnection.ConnectionString = "Persist Security
Info=False;Integrated
Security=SSPI;database=levelheadedbobdb;server=sql 11.mySQLserver.com;Connect
Timeout=30"
myConnection.Open()
MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ ControlChars.Cr + "State: " + myConnection.State.ToString())
myConnection.Close()
End Sub
---------------------------------------------------------------------------------------

Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Tim" <Do*******@netscape.net> schrieb
Hi, I'm kinda new to Dot Net in general and I'm trying to see if I
can get some Connection stuff in a mesage box.. Well, I tried this
code and I get an error that says " Type SQL Connection is not
Defined" .. I have the System.Data reference in solution explorer,
but I'm not sure what references I need? Maybe that isn't the
problem, and if not, can someone tell me what it is?

Thanks in advance
Tim

Code:
----------------------------------------------------------------------

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim myConnection As New SqlConnection


Menu Edit -> Find&Replace -> Find symbol: "SQLConnection". Double-click the
found symbol to jump to the object browser.
You'll see the full qualified name is System.Data.SqlClient.SqlConnection.
Either use this name, or, probably better, Import the System.Data.SqlClient
namespace by putting a

Imports System.Data.SqlClient

at the top of the file, or add it to the Imports list in the project
properties.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.