2

以下のリンクの手順を使用して、カスタム Create_User_Wizard を作成していますが、METADATA エラーが発生しています。誰か助けてくれませんか?

http://weblogs.asp.net/gurusarkar/archive/2009/01/27/storing-user-profile-into-a-custom-table-using-createuser-wizard-control.aspx

以下は、WEB.CONFIG ファイルで使用している接続です。

<add name="ASPNETDBEntities" connectionString="metadata=res://*/App_Code.ASPNETDB.csdl|res://*/App_Code.ASPNETDB.ssdl|res://*/App_Code.ASPNETDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\ASPNETDB.MDF;integrated security=True;user instance=True;multipleactiveresultsets=False;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>

コードビハインドで以下のコードを使用していますenter code here

         //protected void CreateUserWizard2_CreatedUser(object sender, EventArgs e)
        {

// get the user id of the just created user before the final profile is created

            MembershipUser newUser = Membership.GetUser(CreateUserWizard2.UserName);

            Guid newUserId = (Guid)newUser.ProviderUserKey;

            //Get Profile Data Entered by user in CUW control

            String Country =
            ((TextBox)CreateUserWizard2.CreateUserStep.ContentTemplateContainer.FindControl("Country")).Text;

        // Insert a new record into User_Profile

        // Get your Connection String from the web.config. MembershipConnectionString is the name I have in my web.config


        string connectiontest = ConfigurationManager.ConnectionStrings["ASPNETDBEntities"].C

    onnectionString;

            string insertSql = "INSERT INTO User_Profile(UserId,Country) VALUES(@UserId, @Country)";


            using (SqlConnection myConnection = new SqlConnection(connectiontest))

            {
                myConnection.Open();

                SqlCommand myCommand = new SqlCommand(insertSql, myConnection);

                myCommand.Parameters.AddWithValue("@UserID", newUserId);
                myCommand.Parameters.AddWithValue("@Country", Country);
                myCommand.ExecuteNonQuery();
                myConnection.Close();
            }
        }

すべてが正常に機能していますが、「ユーザーの作成」ボタンをクリックした瞬間に、すべてのデータが既存のフィールドから挿入されますが、作成した新しいフィールドからのデータはデータベースに挿入されず、以下に関連するエラーがスローされます一部のメタデータはサポートされていません:

[ユーザーの作成] ボタンをクリックすると、以下のエラーが表示されます

「/」アプリケーションでサーバー エラーが発生しました。

サポートされていないキーワード: 'メタデータ'。

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.ArgumentException: Keyword not supported: 'metadata'.

Source Error:


Line 43: 
Line 44: 
**Line 45:         using (SqlConnection myConnection = new SqlConnection(connectiontest))**
Line 46: 
Line 47:         {


Source File: d:\Decto Web Project\TND\Default.aspx.cs    Line: 45

Stack Trace:


[ArgumentException: Keyword not supported: 'metadata'.]
   System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +5055124
   System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
   System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +64
   System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
   System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +150
   System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +59
   System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
   System.Data.SqlClient.SqlConnection..ctor(String connectionString) +26
   TND_Default.CreateUserWizard2_CreatedUser(Object sender, EventArgs e) in d:\Decto Web Project\TND\Default.aspx.cs:45
   System.Web.UI.WebControls.CreateUserWizard.OnCreatedUser(EventArgs e) +118
   System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +341
   System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +111
   System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +413
   System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +121
   System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +19
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +125
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +167
   System.Web.UI.WebControls.Button.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) +5563
4

1 に答える 1