12. november 2005 - 15:10Der er
5 kommentarer og 1 løsning
Iconvertible Nogen der kan hjælpe med den
Jeg laver noget opret bruger hvor hvor man skal indtaste sit navn og en adgangskode 2 gange.. Når jeg så trykker opret sker dette:
Serverfejl i programmet '/5sem/giderikkemere'. --------------------------------------------------------------------------------
Objektet skal implementere IConvertible. Beskrivelse: Der opstod en ikke-afviklet undtagelse under udførelse af den aktuelle webanmodning. Se staksporingen for at få yderligere oplysninger om fejlen, og hvor den kom fra i koden.
Detaljer om undtagelse: System.InvalidCastException: Objektet skal implementere IConvertible.
-------------------------------------------------------------------------------- Versionsoplysninger: Microsoft .NET Framework version:1.1.4322.2032; ASP.NET version:1.1.4322.2032
Nogen der ved hvad det er og hvordan jeg får fixet det??
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls;
private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here }
#region Web Form Designer generated code override protected void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlConnection1 = new System.Data.SqlClient.SqlConnection(); this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(); this.dataSet11 = new giderikkemere.DataSet1(); ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit(); // // sqlSelectCommand1 // this.sqlSelectCommand1.CommandText = "SELECT ID, Navn, Password FROM Bruger"; this.sqlSelectCommand1.Connection = this.sqlConnection1; // // sqlConnection1 // this.sqlConnection1.ConnectionString = "server=MONTYMUZ;uid=sa;pwd=03051996;database=presentation"; // // sqlInsertCommand1 // this.sqlInsertCommand1.CommandText = "INSERT INTO Bruger(Navn, Password) VALUES (@Navn, @Password); SELECT ID, Navn, Pa" + "ssword FROM Bruger WHERE (ID = @@IDENTITY)"; this.sqlInsertCommand1.Connection = this.sqlConnection1; this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Navn", System.Data.SqlDbType.VarChar, 75, "Navn")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Password", System.Data.SqlDbType.VarChar, 10, "Password")); // // sqlUpdateCommand1 // this.sqlUpdateCommand1.CommandText = @"UPDATE Bruger SET Navn = @Navn, Password = @Password WHERE (ID = @Original_ID) AND (Navn = @Original_Navn OR @Original_Navn IS NULL AND Navn IS NULL) AND (Password = @Original_Password OR @Original_Password IS NULL AND Password IS NULL); SELECT ID, Navn, Password FROM Bruger WHERE (ID = @ID)"; this.sqlUpdateCommand1.Connection = this.sqlConnection1; this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Navn", System.Data.SqlDbType.VarChar, 75, "Navn")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Password", System.Data.SqlDbType.VarChar, 10, "Password")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ID", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Navn", System.Data.SqlDbType.VarChar, 75, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Navn", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Password", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Password", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ID", System.Data.SqlDbType.Int, 4, "ID")); // // sqlDeleteCommand1 // this.sqlDeleteCommand1.CommandText = "DELETE FROM Bruger WHERE (ID = @Original_ID) AND (Navn = @Original_Navn OR @Origi" + "nal_Navn IS NULL AND Navn IS NULL) AND (Password = @Original_Password OR @Origin" + "al_Password IS NULL AND Password IS NULL)"; this.sqlDeleteCommand1.Connection = this.sqlConnection1; this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ID", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Navn", System.Data.SqlDbType.VarChar, 75, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Navn", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Password", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Password", System.Data.DataRowVersion.Original, null)); // // sqlDataAdapter1 // this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1; this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1; this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1; this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "Bruger", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("ID", "ID"), new System.Data.Common.DataColumnMapping("Navn", "Navn"), new System.Data.Common.DataColumnMapping("Password", "Password")})}); this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1; this.bnOpretBruger.Click += new System.EventHandler(this.bnOpretBruger_Click); // // dataSet11 // this.dataSet11.DataSetName = "DataSet1"; this.dataSet11.Locale = new System.Globalization.CultureInfo("da-DK"); this.Load += new System.EventHandler(this.Page_Load); ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.