ciao,
questa è la mia prima connessione, il procedimento è quello di autenticazione. Cioè devo controllare che i dati scritti nel form siano presenti del databse.
il tutto lo faccio cosi:
codice:
<%@ Page Language="vb" %>
<%@ Import NameSpace="System.Data" %>
<%@ Import NameSpace="System.Data.OleDb" %>
<script runat="server">
function strConn() as string
return "provider=Microsoft.Jet.OLEDB.4.0; data source=" & Server.MapPath("mdb-database/fg-tunisie.mdb")
End function
function Query(ByVal name as string, ByVal pass as string) as string
Return "SELECT * FROM Admin WHERE Nome='"& name &"' AND Pwd='"& pass &"' "
end function
Sub Login(ByVal sender As Object, ByVal e As System.EventArgs)
Dim objCmd As New OleDbCommand(Query(User.text,Pwd.Text),strConn())
Dim objReader As OleDbDataReader
objCmd.Open
objReader = objCmd.ExecuteReader
If not objReader.read() Then
response.redirect ("index.aspx")
Else
Errore.Visible = True
Errore.Text = "User o Password ERRATE"
End If
End Sub
</script>
l'errore di compilazione lo ricevo su questa linea:
Dim objCmd As New OleDbCommand(Query(User.text,Pwd.Text),strConn())