|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Apr 2006
Città: Ilê-de-France
Messaggi: 319
|
[ASP.Net(VB] Scrivere in un db
Allora come da titolo come faccio a scrivere in un db su SqlServer?
che modifiche devo apportare a questo sorgente per fare in modo che scriva nel db? Codice:
Dim Utente As String
Dim PassUtente As String
Dim IDUtente As Integer ' variebile del db
Dim Nomedb As String 'variabile del db
Dim Passworddb As String 'variabile del db
Dim StringaSQL = "Driver={Sql Server};Server=.\SQLEXPRESS;Database=nodb;Uid=sa;Pwd=sqlpass"
Dim ConnessioneSQL As New System.Data.Odbc.OdbcConnection(StringaSQL)
Dim QuerySQL As String = "SELECT ID, Nome, Password , FROM Tab Where Nome = '" & TextBox1.Text & "' and Password = '" & TextBox2.Text & "' "
Dim Comando As New System.Data.Odbc.OdbcCommand(QuerySQL, ConnessioneSQL)
Dim Reco As System.Data.Odbc.OdbcDataReader
ConnessioneSQL.Open()
Reco = Comando.ExecuteReader
Utente = TextBox1.Text
PassUtente = TextBox2.Text
If Utente = "" Or PassUtente = "" Then
MsgBox("Inserire Nome Utente o Password", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Informazione")
Else
While (Reco.Read())
With (Reco)
IDUtente = !ID
Nomedb = !Nome
Passworddb = !Password
Label3.Text = Nomedb
Label4.Text = Passworddb
End With
End While
ConnessioneSQL.Close()
Reco.Close()
If Utente = Label3.Text And PassUtente = Label4.Text Then
Session("idditta") = IDDit
Response.Redirect("~/Default.aspx?id=" & Session.SessionID)
Utente = TextBox1.Text
PassUtente = TextBox2.Text
Else
MsgBox("Password Errata!", MsgBoxStyle.Critical +MsgBoxStyle.OkOnly, "Gestione Errori")
Utente = ""
PassUtente = ""
End If
End If
__________________
There is no cloud, it's just someone else computer |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Apr 2006
Città: Ilê-de-France
Messaggi: 319
|
up
__________________
There is no cloud, it's just someone else computer |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Jun 2006
Messaggi: 1077
|
Una delle soluzioni è utilizzare l'SQL e fare un INSERT
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 14:39.



















