Scrivere il risultato di una query

venerdì 07 ottobre 2005 - 18.50

ilpako Profilo | Junior Member

ragazzi come faccio a scrivere il risultato di una query in una textbox?
sqlCmd = "SELECT ID From Potenza WHERE Valore =" & ddlpotenza.SelectedValue
cmd = New OleDbCommand(sqlCmd, dbConn)
aReader = cmd.ExecuteReader()
txtidpot.Text = aReader.GetString(0)

ho provato così ma ottengo solo errori

Cteniza Profilo | Guru

Prova così:

aReader = cmd.ExecuteReader()
If aReader.Read() Then
txtidpot.Text = aReader.GetString(0)
End If

ilpako Profilo | Junior Member

The data value could not be converted for reasons other than sign mismatch or data overflow. For example, the data was corrupted in the data store but the row was still retrievable. come caspita faccio a leggere quel dannato valore selezionato nella ddl??

Cteniza Profilo | Guru

Prova con:
If aReader.Read() Then
txtidpot.Text = ctype(aReader(0),Integer).ToString
End If



Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5