using System;
using System.Data;
using System.Configur ation;
using System.Collecti ons;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;
using System.Data.Sql Client;
using Sybase.Data.Ase Client;
public partial class delete : System.Web.UI.P age
{
private AseConnection TempDMT_conn = new AseConnection(C onfigurationSet tings.AppSettin gs["connectionStri ng"]);
protected void Page_Load(objec t sender, EventArgs e)
{
}
protected void Button1_Click(o bject sender, EventArgs e)
{
string username = txtusername.Tex t;
TempDMT_conn.Op en();
AseDataAdapter adapter = new AseDataAdapter( );
adapter.Missing MappingAction = MissingMappingA ction.Passthrou gh;
adapter.Missing SchemaAction = MissingSchemaAc tion.AddWithKey ;
adapter.SelectC ommand = new AseCommand(
"SELECT * FROM login WHERE username= @username ",
TempDMT_conn);
adapter.DeleteC ommand = new AseCommand(
"DELETE FROM login WHERE username = @username",
TempDMT_conn);
adapter.DeleteC ommand.UpdatedR owSource =
UpdateRowSource .None;
AseParameter parm = new AseParameter("@ username",
AseDbType.Text, 10);
parm.SourceColu mn = "username";
parm.SourceVers ion = DataRowVersion. Original;
adapter.DeleteC ommand.Paramete rs.Add(parm);
DataTable dataTable = new DataTable("logi n");
int rowCount = adapter.Fill(da taTable);
foreach (DataRow row in dataTable.Rows)
{
row.Delete();
}
int recordsAffected = adapter.Update( dataTable);
dataTable.Clear ();
TempDMT_conn.Cl ose();
}
}
how can i fix this error message
Must declare variable '@username'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Sybase.Data.Ase Client.AseExcep tion: Must declare variable '@username'.
Source Error:
Line 50: int rowCount = adapter.Fill(da taTable);
using System.Data;
using System.Configur ation;
using System.Collecti ons;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;
using System.Data.Sql Client;
using Sybase.Data.Ase Client;
public partial class delete : System.Web.UI.P age
{
private AseConnection TempDMT_conn = new AseConnection(C onfigurationSet tings.AppSettin gs["connectionStri ng"]);
protected void Page_Load(objec t sender, EventArgs e)
{
}
protected void Button1_Click(o bject sender, EventArgs e)
{
string username = txtusername.Tex t;
TempDMT_conn.Op en();
AseDataAdapter adapter = new AseDataAdapter( );
adapter.Missing MappingAction = MissingMappingA ction.Passthrou gh;
adapter.Missing SchemaAction = MissingSchemaAc tion.AddWithKey ;
adapter.SelectC ommand = new AseCommand(
"SELECT * FROM login WHERE username= @username ",
TempDMT_conn);
adapter.DeleteC ommand = new AseCommand(
"DELETE FROM login WHERE username = @username",
TempDMT_conn);
adapter.DeleteC ommand.UpdatedR owSource =
UpdateRowSource .None;
AseParameter parm = new AseParameter("@ username",
AseDbType.Text, 10);
parm.SourceColu mn = "username";
parm.SourceVers ion = DataRowVersion. Original;
adapter.DeleteC ommand.Paramete rs.Add(parm);
DataTable dataTable = new DataTable("logi n");
int rowCount = adapter.Fill(da taTable);
foreach (DataRow row in dataTable.Rows)
{
row.Delete();
}
int recordsAffected = adapter.Update( dataTable);
dataTable.Clear ();
TempDMT_conn.Cl ose();
}
}
how can i fix this error message
Must declare variable '@username'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Sybase.Data.Ase Client.AseExcep tion: Must declare variable '@username'.
Source Error:
Line 50: int rowCount = adapter.Fill(da taTable);