Perfecto muchas gracias, solo que en lugar de AND tube que usar OR porque el campo4 de la tabla2 puede estar vacío y su es asi con el and no me devuelve nada.
Muchas gracias.
Muchas gracias.
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúSELECT * FROM(tabla1) INNER JOIN tabla2 ON tabla1.id=tabla2.id_tabla1 INNER JOIN tabla3 ON tabla2.campo3=tabla3.id
Public MyTimer As New System.Timers.Timer(1000) '1000 es el intervalo en milisegundos
'Este es el procedimiento que ejecutara el timer
Public Sub CodeToRun()
'bloque de codigo que se ejecuta cada 1 segundo
Try
Dim Com As New OdbcConnection("dsn=mysql_juego;uid=xxxx;pwd=xxxxxx;")
Com.Open()
Dim Comando As New OdbcCommand("UPDATE `datos`.`usuarios` SET `X` = '" & hero.x & "' , `Y` = '" & hero.y & "' WHERE `usuarios`.`id` = " & id_usuario, Com)
Comando.CommandType = CommandType.Text
Comando.ExecuteNonQuery()
Com.Close()
Dim DA_usuarios As New OdbcDataAdapter("Select * From usuarios where mapa = '" & dt_usu.Rows(0).Item(4).ToString & "' and estado = 'libre' and id <> '" & id_usuario & "'", conexionBD) 'por segundo parametro se puede pasar un objeto conexion como directamente le string de conexion
DA_usuarios.Fill(DS_usuarios, "id") 'manda ejecutar la sentecia SQL o el PA que le indicamos al adaptador y el resultado de esa ejecucion a guarda como un objeto datatable con el nombre del 2o parametro del fill dentro del dataset que le pasasmos como 1er parametro
dt_usuarios = DS_usuarios.Tables("id")
usuarios_online = dt_usuarios.Rows.Count
Catch ex As Exception
End Try
Try
If usuarios_online <> 0 Then
For i = 0 To usuarios_online - 1
hero1 = New AnimatedSprite
hero1.Animations.Remove("WalkUp")
hero1.Animations.Remove("WalkRight")
hero1.Animations.Remove("WalkDown")
hero1.Animations.Remove("WalkLeft")
hero1.Animations.Add("WalkUp", New Animation(walkUp, 35))
hero1.Animations.Add("WalkRight", New Animation(walkRight, 35))
hero1.Animations.Add("WalkDown", New Animation(walkDown, 35))
hero1.Animations.Add("WalkLeft", New Animation(walkLeft, 35))
hero1.TransparentColor = Color.Magenta
If x1 > dt_usuarios.Rows(i).Item(5) Then
hero1.CurrentAnimation = "WalkLeft"
ElseIf x1 < dt_usuarios.Rows(i).Item(5) Then
hero1.CurrentAnimation = "WalkRight"
ElseIf y1 > dt_usuarios.Rows(i).Item(6) Then
hero1.CurrentAnimation = "WalkUp"
Else
hero1.CurrentAnimation = "WalkDown"
End If
x1 = dt_usuarios.Rows(i).Item(5)
y1 = dt_usuarios.Rows(i).Item(6)
hero1.Center = New Point(x1, y1)
heros.Insert(i, hero1)
nom_hero1 = New SdlDotNet.Sprites.TextSprite(dt_usuarios.Rows(i).Item(3), fuente, Color.White, New Point(hero1.X, hero1.Y - 15))
nom_heros.Insert(i, nom_hero1)
nom_hero1 = Nothing
hero1 = Nothing
Next
Else
hero1 = Nothing
End If
dt_usuarios.Reset()
Catch ex As Exception
End Try
End Sub
mapa1.Render(Video.Screen)
logo.Render(Video.Screen)
hero.Render(Video.Screen)
panel.Render(Video.Screen)
texto3.Render(Video.Screen)
Dim usu As New SdlDotNet.Sprites.TextSprite(usuarios_online, fuente, Color.White, New Point(20, 20))
usu.Render(Video.Screen)
If usuarios_online <> 0 Then
For i = 0 To usuarios_online - 1
heros(i).Render(Video.Screen)
nom_heros(i).Render(Video.Screen)
Next
End If