首页 > 代码库 > 123

123

技术分享
1 <TextBlock Text=" 用户名" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" Grid.Row="0" Grid.Column="1"></TextBlock>2         <TextBox  Grid.Row="0" Grid.Column="2" Name="User" Height="30" Width="80"></TextBox>3         <TextBlock Text=" 密码" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" Grid.Row="1" Grid.Column="1"></TextBlock>4         <TextBox Grid.Row="1" Grid.Column="2" Name="Pst" Height="30" Width="80"></TextBox>5         <TextBlock Text=" 身份证号" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" Grid.Row="3" Grid.Column="1"></TextBlock>6         <TextBlock Text=" 确认密码" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="15" Grid.Row="2" Grid.Column="1"></TextBlock>7         <Button x:Name="CancelButton" Content="取消" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Center" Grid.Row="4" Grid.Column="2"/>8         <Button x:Name="OKButton" Content="确定" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Center" Grid.Row="4" Grid.Column="1"/>
注册界面
、public bool creatUser(string userName, string userPsd)            {                try                {                    pSqlConn = new SqlConnection(sSqlConnString);                    pSqlConn.Open();                    SqlCommand comm = new SqlCommand();                    comm.Connection = pSqlConn;                    comm.CommandType = CommandType.Text;                    comm.CommandText = string.Format("insert into Table_1([Username],[Password]) values (‘" + userName + "‘,‘" + userPsd + "‘)");                    comm.ExecuteNonQuery();                    pSqlConn.Close();                    return true;                }                catch
public partial class regist : ChildWindow    {        public regist()        {            InitializeComponent();        }        private void OKButton_Click(object sender, RoutedEventArgs e)        {            string userName = User.Text;            string userPsd = Pst.Text;            DBServerSR.DBService1Client pppp = new DBService1Client();            pppp.creatUserAsync(userName,userPsd);            pppp.creatUserCompleted += pppp_creatUserCompleted;        }        void pppp_creatUserCompleted(object sender, creatUserCompletedEventArgs e)        {            try            {                if (e.Result)                {                    MessageBox.Show("注册成功!");                    this.Content = new MainPage();                }                else                {                    MessageBox.Show("注册失败!");                }            }            catch            {                MessageBox.Show("网络无法访问!");            }        }

 

           {                    return false;                }            }

 

123