therealzeta
Member
- Joined
- Aug 9, 2008
- Messages
- 19
- Programming Experience
- 5-10
hello. i am new on the .net envioroment. I copy the followin code from a tutorial but when i execute it, i found the following error. it is a silly error but i dont have the msdn so, i have no help at all.
thxs
this is the error:
and this is the code
thxs
this is the error:
c:\inetpub\wwwroot\Consultorio\WebForm1.aspx.vb(34): Type 'SqlConnection' is not defined.
and this is the code
VB.NET:
Imports System.Data.SqlClient
'....
Try
' crear el objeto de conexión
Dim oConexion As New SqlConnection()
' pasar la cadena de conexión
oConexion.ConnectionString = "server=(local);" & "database=Xnorthwind;uid=sa;pwd=;"
' abrir conexión
oConexion.Open()
MessageBox.Show("Conectado")
' cerrar conexión
oConexion.Close()
MessageBox.Show("Desconectado")
Catch oExcep As SqlException
' si se produce algún error,
' lo capturamos mediante el objeto
' de excepciones particular para
' el proveedor de SQL Server
MessageBox.Show("Error al conectar con datos" & _
ControlChars.CrLf & _
oExcep.Message & ControlChars.CrLf & _
oExcep.Server)
End Try