Jump to content

Listview não exibe dados (ASP.NET)


clovisystem

Recommended Posts

não consigo exibir os dados do banco de dados ACCESS no LISTVIEW da pagina ASP.NET... Eu tenho que digitar um valor que está no BD numa textbox e o mesmo não retorna ... Eis o código:


Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click


If TextBox2.Text = "COMPUTADOR" Then
ListView1.Visible = True
ListView2.Visible = False
Dim consulta As String
Dim conexao As OleDbConnection
Dim comando As OleDbCommand

consulta = "SELECT solucao FROM COMPUTADOR WHERE defeito LIKE'%" & TextBox1.Text & "%'"
conexao = New OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0; Data Source= ~/App_Data/consertando.mdb")
comando = New OleDbCommand(consulta, conexao)

conexapen()
comando.ExecuteNonQuery()
conexao.Close()

 

Link to comment
Share on other sites

  • 2 weeks later...
1 hora atrás, General disse:

Boa tarde, primeito o executenonquery não retorna dados!! É utilizado para INSERT, UPDATE ou DELETE's. Tens que usar o ExecuteReader. Depois tens que especificar para que objecto. Neste caso o ListView.  Aconselho a veres este link: http://www.vb-helper.com/howto_net_load_listview_from_db.html
 

Obrigado amigo. Eu acabei verficando isso no google. Abraços!
 

Link to comment
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
×
×
  • 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.