为什么有这样的异常,请高手指教.
下面是我的一个代码片断:
private void CreateUers(String name, String password)
{
UserData user = new UserData();
DataTable table = user.Tables[UserData.USERS_TABLE];
DataRow row = table.NewRow(); //提示这里出错.
row[UserData.NAME_FIELD] = this.NameBox.Text;
row[UserData.PASSWORD_FIELD] = this.PasswordBox.Text;
table.Rows.Add(row);
using (DataAccess.UserAccess useraccess = new UserAccess())
{
useraccess.InsertUser(user);
}
}
程序的编译没有问题,但是运行时提示如下异常?为什么?
Additional information: Object reference not set to an instance of an object.