Iserimento dati

sabato 09 giugno 2012 - 21.00

drugomatera Profilo | Newbie

ciao a tutti , il mio problema è il seguente :
devo inserire una mail presa da un form in un database access usando oledb ... al momento dell inserimento vorrei che si controllasse se la mail è già presente nel database . come posso fare ? si può usare l' oggetto datareader o cosa ? grazie

Mau67 Profilo | Expert

Ciao prova con questo

Dim objDataAdapter As New MySqlDataAdapter( _
"SELECT count (Email)from TUA TABELLA Where Email = '" & TextBox1.Text & "'", Connection)
' Initialize a new instance of the DataSet object...
objDataSet = New DataSet()
' Fill the DataSet object with data...
objDataAdapter.Fill(objDataSet, "TUA TABELLA")
Dim rw As DataRow
For Each rw In objDataSet.Tables("TUA TABELLA").Rows
If rw.Item(0) = 0 Then
Try
'QUI METTI LA INSERT
Catch ex As Exception
End Try
Else
MsgBox("Email già presente")

ciao ciao
Mau67
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-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5