using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Data.SqlClient;
namespace User_OOP
{
class UserHelp
{
//用户名
private string userID;
public string UserID
{
get { return userID; }
set { userID = value; }
}
//密码
private string password;
public string Password
{
get { return password; }
set { password = value; }
}
//确认密码
private char passtoo;
public char Passtoo
{
get { return passtoo; }
set { passtoo = value; }
}
//年龄
private int age;
public int Age
{
get { return age; }
set
{
if (age <= 0 || age >= 100)
{
age = 18;
}
else
{
age = value;
}
}
}
//性别
private string sex;
public string Sex
{
get { return sex; }
set { sex = value; }
}
public UserHelp(string name, string pass)
{
this.UserID = name;
this.Password = pass;
}
public UserHelp(string name, string pass, int age, string sex)
{
this.UserID = name.ToString();
this.Password = pass.ToString();
this.Age = Convert.ToInt32(age);
this.Sex = sex.ToString();
}
public string Show(string message)
{
string sql = string.Format("insert into dbo.UserInfo(userID,pass,age,sex)values('{0}','{1}','{2}','{3}')", userID, password, age, sex);
SqlCommand comm = new SqlCommand(sql, dbhelper.conn);
dbhelper.conn.Open();
int count = Convert.ToInt32(comm.ExecuteNonQuery());
if (count>0)
{
message = string.Format(userID, password, age, sex);
return message;
}
return message;
}
}
}
USE 类中 当我注册成功时候 MESSAGEBOX消息框弹出我注册信息
求解
在MAIN方法下怎么写,因为在类里没有MESSAGEBOX