Jump to content
Sign in to follow this  
elementsky

Vb.NET 2005 com MySql!

Recommended Posts

kahoz

Imports MySql.Data.MySqlClient

Namespace or type 'MySqlClient' for the Imports 'MySql.Data.MySqlClient' cannot be found.

..alguma ideia ? :|

agradecido desde ja' :confused:


-lopes.

Share this post


Link to post
Share on other sites
kahoz

ja' esta' a funcionar.. :(

obrigado! []

-- edit --

agora, outra duvida..

estou a seguir o tutorial em http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-4/ para fazer um formulario de login

o codigo que tenho por agora e' este

Imports MySql.Data.MySqlClient
Imports System.Text
Imports System.Security.Cryptography

Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim conn As MySqlConnection
    Dim myCommand As New MySqlCommand
    Dim myAdapter As New MySqlDataAdapter
    Dim myData As New DataTable
    Dim SQL As String
    Dim myCommand As New MySqlCommand
    Dim myAdapter As New MySqlDataAdapter
    Dim myData As New DataTable

    Private Function CriaMD5(ByVal SourceText As String) As String
        'esta roubei algueres na net ^^
        Dim Ue As New UnicodeEncoding
        Dim ByteSourceText() As Byte = Ue.GetBytes(SourceText)
        Dim Md5 As New MD5CryptoServiceProvider
        Dim ByteHash() As Byte = MD5.ComputeHash(ByteSourceText)
        Return Convert.ToBase64String(ByteHash)
    End Function

    Private Sub btnlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click
        Dim utilizador As String
        Dim password As String
        conn = New MySqlConnection
        conn.ConnectionString = "server=localhost; user id=root; password=whatever; database=umadb"
        conn.Open()
        utilizador = txtutilizador.Text()
        password = CriaMD5(txtpassword.Text())
        MessageBox.Show(password)
        SQL = "select * from adminstradores where utilizador =" + utilizador + " and password =" + password
        myCommand.Connection = conn
        myCommand.CommandText = SQL
        myAdapter.SelectCommand = myCommand
        myAdapter.Fill(myData)

    End Sub
End Class

apartir daqui, como e' q vejo se a consulta devolveu alguma linha e se sim, como e' que as comparo ? :|

abraço e um obrigado antecipado!

:D


-lopes.

Share this post


Link to post
Share on other sites
Asgorath

Basta ver quantas rows a tua DataTable MyData tem.

Jorge


"The Dark Side Clouds Everthing. Impossible To See The Future Is."My rig: Intel Core 2 Quad Q9450 | abit IP35P | 4G Kingston 800 Mhz | XFX GeForce 9800 GX2 1G ddr3 | 2X WD5000AAJS 500Gb Sata 2 | PSU 600W || Caixa El-Diablo | Creative XMod

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.