sto provando a creare un login. e devo usare per forza access... la mia funzione di login è la seguente:
al momento di effettuare l'ExecuteReader, il try mi porta direttamente al catch, e il messaggio che mi da è il seguente: "Nessun valore specificato per alcuni parametri necessari."Codice PHP:public void DoLogin(Object o, EventArgs e)
{
string strConn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + Request.MapPath("../App_Data/vasco.mdb");
OleDbConnection objConn = new OleDbConnection(conn);
objConn.Open();
string query = "SELECT * FROM utenti where username='" + user.Value + "' and password='" + pass.Value + "'";
OleDbCommand objCommand = new OleDbCommand(query, objConn);
OleDbDataReader objDataReader;
try
{
objDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConnection);
if (objDataReader.Read())
{
if (user.Value == objDataReader["username"].ToString() && pass.Value == objDataReader["password"].ToString())
{
Session["username"] = user.Value;
//Response.Redirect("Default.aspx");
errore.Text ="[b]LOGIN EFFETTUATO CON L'USERNAME: " + Session["username"] + "!!![/b]";
}
}
else
errore.Text = "[b]Username e Password non corretti![/b]";
}
catch (Exception er)
{
errore.Text = "[b]errore2: [/b]"+er.Message;
}
objConn.Close();
}
lo stack invece è il seguente:
in cosa sbaglio?Codice PHP:[OleDbException (0x80040e10): Nessun valore specificato per alcuni parametri necessari.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +1002416
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +255
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +188
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +58
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +161
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +116
System.Data.OleDb.OleDbCommand.ExecuteReader() +6
admin_login.ReadMyData(String connectionString) in c:\Documents and Settings\cyberwolf\Documenti\Visual Studio 2008\WebSites\VascoStudioDance\admin\login.aspx.cs:29
admin_login.DoLogin(Object o, EventArgs e) in c:\Documents and Settings\cyberwolf\Documenti\Visual Studio 2008\WebSites\VascoStudioDance\admin\login.aspx.cs:77
System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e) +111
System.Web.UI.HtmlControls.HtmlInputButton.RaisePostBackEvent(String eventArgument) +109
System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

Rispondi quotando