首页 > 代码库 > 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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。