Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it L'avatar di hkproj
    Registrato dal
    Jul 2006
    Messaggi
    250

    [ASP.NET 2.0 - VB]Problema nell'esecuzione di una query sql

    Ciao, ho un sito web che fa schifo, cmq vorrei creare qualcosa per decifrare password md5
    ecco il mio database (Access 2003) di md5:
    Tabella: Hashes che ha due campi (Value, Hash)
    io avendo il hash vorrei recuperare il valore del campo Value, allora ho scritto una query sql.
    ecco il mio codice:

    codice:
    Imports System.Drawing
    Imports System.IO
    Imports System.Data
    Imports System.Data.OleDb
    Imports System.Data.SqlClient
    Imports System.Security.Cryptography
    
    Partial Class _Default
        Inherits System.Web.UI.Page
        Dim Cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=MD5s.MDB;")
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
        End Sub
    
        Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
    
            If txtSearch.Text = "" Then
                txtSearch.Text = "Type here the Hash"
                Exit Sub
            ElseIf txtSearch.Text.Length > 32 Then
                txtSearch.Text = "Max length = 32"
            End If
            If Cn.State <> ConnectionState.Open Then
                Cn.Open()
            End If
            Dim Command As String = "SELECT * From Hashes Where (Hash = " & txtSearch.Text & ")"
            Dim Cmd As New OleDbCommand(Command, Cn)
            Dim Results As OleDbDataReader = Cmd.ExecuteReader
            If Results.FieldCount > 0 Then
                lblHash.Text = Results.Item("Hash")
                lblValue.Text = Results.Item("Value")
            Else
                txtSearch.Text = "There isn't any result"
            End If
    
        End Sub
    
    End Class
    Il problema sorge qui: appena il web server cerca di eseguire il codice, si presenta un errore che dice: Errore di sintassi (operatore mancante) nell'espressione della query '(Hash = 5f4dcc3b5aa765d61d8327deb882cf99)'
    qualcuno mi può aiutare?
    PS: ho aperto un'altra discussione in Programmazione --> Visual Basic e .net framework, ma l'ho fatto perkè quel codice della programmazione mi serve per un software e questo per un sito web. Perfavore non chiudetemi la discussione
    Ciao
    --------------------HkProj------------------

  2. #2
    Utente di HTML.it L'avatar di hkproj
    Registrato dal
    Jul 2006
    Messaggi
    250
    ecco risolto!
    il problema era qui: "SELECT * From Hashes Where (Hash = " & txtSearch.Text & ")"
    e doveva essere così: "SELECT * From Hashes Where '(Hash '=' " & txtSearch.Text & ")'"
    però io non so come leggere i record restituiti dalla query, potete aiutarmi?
    --------------------HkProj------------------

  3. #3
    Utente di HTML.it L'avatar di hkproj
    Registrato dal
    Jul 2006
    Messaggi
    250
    ho risolto anche l'ultimo problema, ma quando cerco una stringa Hash, mi restituisce sempre lo stesso risultato. coma mai?
    --------------------HkProj------------------

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.