freegirl, deverias leerte el capitulo de acceso a datos.. creo que te falta leer algo por ahi...
Código:
Private Function getText(ByVal campo2 As Integer) As String
Dim result As String = ""
Try
Dim comm As New SqlCommand("select campo1 from tabla where campo2=@campo2", New SqlConnection(AppSettings("TuConnection")))
comm.CommandType = CommandType.Text
comm.Parameters.Add("@campo2", campo2)
comm.Connection.Open()
Dim reader As SqlDataReader = comm.ExecuteReader(CommandBehavior.CloseConnection)
If reader.HasRows Then
reader.Read
result = reader("campo1")
End If
reader.Close()
Catch ex As Exception
End Try
Return result
End Function
Y lo llamas asi..
Mitxt.text = getText(1)
Salu2