Hi I have just migrated from MS SQL to MS SQL-CE, now I have this problem DB requieres to many inpust, I didnt have this problem before. Here is code which i am using
db.Execute("INSERT INTO UserProfile VALUES (@0,'0',@1,'0','','0')", name, email);
and here is table definition
CREATE TABLE UserProfile
(UserId bigint NOT NULL IDENTITY(1,1) PRIMARY KEY,
[User] nvarchar(50) NOT NULL,
[Group] smallint,
Email nvarchar(50),
TipsByEmail smallint,
Phone nvarchar(50),
TipsBySMS smallint);
and here is error
Server Error in '/' Application.
The number of columns in the query and the table must match. [ Number of columns in query = 6, Number of columns in table = 7 ]
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: System.Data.SqlServerCe.SqlCeException: The number of columns in the query and the table must match. [ Number of columns in query = 6, Number of columns in table = 7 ]
Source Error:
Line 35: if (!user)
Line 36: {
Line 37: db.Execute("INSERT INTO UserProfile VALUES (@0,'0',@1,'0','','0')", name, email);
Line 38: WebSecurity.CreateAccount(name, password, false);
Line 39: WebSecurity.Login(name,password,true);
Source File: h:\root\home\pedro007-001\www\site\Register.cshtml Line: 37
Stack Trace:
[SqlCeException (0x80004005): The number of columns in the query and the table must match. [ Number of columns in query = 6, Number of columns in table = 7 ]]
System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr) +48
System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan() +700
System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options) +542
System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery() +21
WebMatrix.Data.Database.Execute(String commandText, Object[] args) +111
ASP._Page_Register_cshtml.Execute() in h:\root\home\pedro007-001\www\site\Register.cshtml:37
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +199
System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +69
System.Web.WebPages.WebPage.ExecutePageHierarchy() +131
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +116
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18045