gpt4 book ai didi

c# - 如何在类中使用 MembershipCreateStatus

转载 作者:太空狗 更新时间:2023-10-30 00:57:23 26 4
gpt4 key购买 nike

我正在尝试使用 .NET 成员资格提供程序,但我不知道如何使用。

这是我的代码:

using System;
using System.Web;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web.Security;
using System.Collections.Specialized;
using System.Data.SqlClient;
using System.Web.Security.SqlMembershipProvider;

namespace CustomMembership
{
public class CustomMembership
{
public static void CreateUser(String UserName, String Password, String Email, out MembershipCreateStatus Result)
{
SqlConnection Conn= new SqlConnection(@"Data Source=A-PC\SQLEXPRESS;Initial Catalog=OyunSitesi;User ID=XXX;Password=XXX");

Conn.Open();

SqlCommand CreateUserCommand= new SqlCommand("Inser Into Uyeler (UyeKullaniciAdi,UyeSifre,UyeEposta,UyeGrubu) Values('"+KullaniciAdi+"','"+Sifresi+"','"+EpostaAdresi+"')",Conn);
CreateUserCommand.ExecuteNonQuery();

代码继续......

我的问题是此代码返回找不到类型或命名空间名称“MembershipCreateStatus”(是否缺少 using 指令或程序集引用?)

我该如何解决这个问题?

最佳答案

添加对程序集 System.Web.ApplicationServices 的引用。它应该可以解决问题。

关于c# - 如何在类中使用 MembershipCreateStatus,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5315127/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com