0
以下は入力ボックスを介してデータをテーブルに挿入するためのコードですが、いくつかのデータ検証は既に使用していますが、電子メールアドレス入力ボックスがあるかどうかを確認する方法電子メールの形式(@。)C#で電子メールアドレスのデータ検証を作成する方法
private void ECVSavebutton(object sender, RoutedEventArgs e)
{
string EmployeeAvailability;
if (Job1DropDownBox.Text == "True" && Job2DropDownBox.Text == "True" && Job3DropDownBox.Text == "True")
{
EmployeeAvailability = "False";
} else
{
EmployeeAvailability = "True";
}
{
if (PostcodeInputBox.Text.Count() >= 7)
PostcodeInputBox.Text = null;
}
Connection.Open();
SqlCommand Command = new SqlCommand(null, Connection);
Command.CommandText = "Insert into [StaffDetails] (Forename,Surname,DateofBirth,Emailaddress,Country,Address,City,Postcode,Skill1,Skill2,Skill3,Job1,Job2,Job3,EmployeeAvailability,Location) Values(@forename, @surname, @dateofbirth, @emailaddress, @country, @address, @city, @postcode, @skill1, @skill2, @skill3, @job1, @job2, @job3, @employeeavailability,@location)";
Command.Parameters.AddWithValue("@forename", ForenameInputBox.Text);
Command.Parameters.AddWithValue("@surname", SurnameInputBox.Text);
Command.Parameters.AddWithValue("@dateofbirth", DateOfBirthPicker.SelectedDate);
Command.Parameters.AddWithValue("@emailaddress", EmailInputBox.Text);
Command.Parameters.AddWithValue("@country", CountryInputBox.Text);
Command.Parameters.AddWithValue("@address", AddressInputBox.Text);
Command.Parameters.AddWithValue("@city", CityInputBox.Text);
Command.Parameters.AddWithValue("@postcode", PostcodeInputBox.Text);
Command.Parameters.AddWithValue("@skill1", Skill1DropDownBox.Text);
Command.Parameters.AddWithValue("@skill2", Skill2DropDownBox.Text);
Command.Parameters.AddWithValue("@skill3", Skill3DropDownBox.Text);
Command.Parameters.AddWithValue("@job1", Job1DropDownBox.Text);
Command.Parameters.AddWithValue("@job2", Job2DropDownBox.Text);
Command.Parameters.AddWithValue("@job3", Job3DropDownBox.Text);
Command.Parameters.AddWithValue("@employeeavailability", EmployeeAvailability);
Command.Parameters.AddWithValue("@location", LocationDropDownBox.Text);
Command.ExecuteNonQuery();
Connection.Close();
電子メールアドレスを検証する[C#コード]の可能な複製(http://stackoverflow.com/questions/1365407/c-sharp-code-to-確認電子メールアドレス) – NotTelling
チェック[これ](http://stackoverflow.com/questions/7173401/c-sharp-email-validation-confused-by-mailaddress-behavior-johngmail-is-val) –
こんにちはInstanfin、あなたの助けてくれてありがとう、私はその質問を読んだが、実際に何が書かれていたのか分からず、コピーするよりも可能ならそれを私に説明する人を探していた。 –