Use the following code, this will help you:
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text.Trim() == String.Empty)
{
MessageBox.Show("please enter the school Id");
}
else
{
sb.SCHOOLID = int.Parse(textBox1.Text);
}
if (textBox2.Text.Trim() == String.Empty)
{
MessageBox.Show("please ente the school name");
}
else
{
sb.SCHOOLNAME = textBox2.Text.ToString();
}
sb.CREATEDDATEANDTIME = DateTime.Now;
}