asp.net Web 应用程序 (.net framework) 无法调用数据表
asp.net web application (.net framework) unable to call daatables
我只想在有人成功创建帐户时将额外信息传递给 sql 服务器,问题是我无法调用包含我的查询的表适配器。我制作了数据集 xsd 并制作了表格,但我似乎无法调用它们,这是在 asp.net 网络应用程序(.net 框架)
中完成的
using System;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Owin;
using CAEWEBBASE.Models;
namespace CAEWEBBASE.Account
{
public partial class Register : Page
{
protected void CreateUser_Click(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>();
var user = new ApplicationUser() { UserName = Email.Text, Email = Email.Text };
IdentityResult result = manager.Create(user, Password.Text);
if (result.Succeeded)
{
<want to add call to table adapter here to pass data>
// For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
//string code = manager.GenerateEmailConfirmationToken(user.Id);
//string callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id, Request);
//manager.SendEmail(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>.");
signInManager.SignIn( user, isPersistent: false, rememberBrowser: false);
IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
}
else
{
ErrorMessage.Text = result.Errors.FirstOrDefault();
}
}
}
}
我终于找到了解决办法。首先,我在 App_Data
文件夹中有数据集;它需要位于 App_Code
文件夹中才能作为包含表格的适当数据集。
接下来,你必须打开数据集的下拉菜单,然后 select 设计器,然后将构建操作更改为编译,然后重建你的项目,然后你就可以访问任何有争议的你的代码在后面。
我只想在有人成功创建帐户时将额外信息传递给 sql 服务器,问题是我无法调用包含我的查询的表适配器。我制作了数据集 xsd 并制作了表格,但我似乎无法调用它们,这是在 asp.net 网络应用程序(.net 框架)
中完成的using System;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Owin;
using CAEWEBBASE.Models;
namespace CAEWEBBASE.Account
{
public partial class Register : Page
{
protected void CreateUser_Click(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>();
var user = new ApplicationUser() { UserName = Email.Text, Email = Email.Text };
IdentityResult result = manager.Create(user, Password.Text);
if (result.Succeeded)
{
<want to add call to table adapter here to pass data>
// For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
//string code = manager.GenerateEmailConfirmationToken(user.Id);
//string callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id, Request);
//manager.SendEmail(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>.");
signInManager.SignIn( user, isPersistent: false, rememberBrowser: false);
IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
}
else
{
ErrorMessage.Text = result.Errors.FirstOrDefault();
}
}
}
}
我终于找到了解决办法。首先,我在 App_Data
文件夹中有数据集;它需要位于 App_Code
文件夹中才能作为包含表格的适当数据集。
接下来,你必须打开数据集的下拉菜单,然后 select 设计器,然后将构建操作更改为编译,然后重建你的项目,然后你就可以访问任何有争议的你的代码在后面。