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

T

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=sql11.mySQLserver.com;Connect
Timeout=30"
myConnection.Open()
MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ ControlChars.Cr + "State: " + myConnection.State.ToString())
myConnection.Close()
End Sub
---------------------------------------------------------------------------------------
 
A

Armin Zingler

Tim said:
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
 

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