我在下面有一些代码:
SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
command.Parameters.AddWithValue("@company", txtCompany.Text);
command.Parameters.AddWithValue("@server", txtServer.Text);
command.Parameters.AddWithValue("@username", txtUserName.Text);
command.Parameters.AddWithValue("@password", txtPassword.Text);
如何验证空文本框以确保始终填充文本框?
我努力了:
if (string.IsNullOrEmpty(txtCompany.Text))
{
//do work here
}
else
{
}
但是我不确定如何分配这样的所有文本框?以一种更简洁的方式限制我必须编写的代码行数?