![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
29/12/2004, 03:39
|
| | Fecha de Ingreso: agosto-2003
Mensajes: 398
Antigüedad: 21 años, 5 meses Puntos: 0 | |
Hola utilizo vb.net y este es el código que estoy probando:
Option Explicit On
Option Strict On
Option Compare Text
Imports MySQLDriverCS
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Código generado por el Diseñador de Windows Forms "
Public Sub New()
MyBase.New()
'El Diseñador de Windows Forms requiere esta llamada.
InitializeComponent()
'Agregar cualquier inicialización después de la llamada a InitializeComponent()
End Sub
'Form reemplaza a Dispose para limpiar la lista de componentes.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requerido por el Diseñador de Windows Forms
Private components As System.ComponentModel.IContainer
'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento
'Puede modificarse utilizando el Diseñador de Windows Forms.
'No lo modifique con el editor de código.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(496, 277)
Me.Name = "Form1"
Me.Text = "Form1"
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim bConexionExitosa As Boolean = True
Dim DBCon As MySQLConnection
DBCon = New MySQLConnection(New MySQLConnectionString("https://mysql.webcindario.com", "taurus427", "taurus427", "contraseña", 3306).AsString)
Try
DBCon.Open()
Catch ex As MySQLException
MsgBox(ex.Message.ToString)
bConexionExitosa = False
End Try
If bConexionExitosa Then
Dim f() As String = {"id", "nombre"}
Dim t() As String = {"prueba"}
Dim dt As DataTable = New MySQLSelectCommand(DBCon, f, t, Nothing, Nothing, Nothing).Table
If (dt.Rows.Count <> 0) Then
Dim drow As DataRow
For Each drow In dt.Rows
MsgBox(drow("nombre"))
Next
End If
Dim sql As MySQLCommand = New MySQLCommand
sql.Connection = DBCon
sql.CommandText = "SELECT * FROM `prueba` WHERE `nombre` LIKE '_a%e_';"
sql.CommandType = CommandType.Text
Dim dr As System.Data.IDataReader
dr = sql.ExecuteReader()
While dr.Read()
MsgBox(dr("nombre"))
End While
DBCon.Close()
End If
End Sub
End Class
Espero me puedan ayudar a realizar una conexion a un servidor remoto. Si conocen alguna clase un poco mas segura y mas fiable os ruego que me lo digais.
Un Saludo y Gracias por todo |