1.对于SqlParameter
SqlParameter[] param =
{
new SqlParameter("@Name",SqlDbType.NVarChar,32),
new SqlParameter("@Gender",SqlDbType.Int),
new SqlParameter("@Image",SqlDbType.NVarChar,65535),
new SqlParameter("@Birdate",SqlDbType.DateTime),
new SqlParameter("@Edudeg",SqlDbType.NChar,10),
new SqlParameter("@Tel",SqlDbType.Char,11),
new SqlParameter("@QQ",SqlDbType.VarChar,11),
new SqlParameter("@Email",SqlDbType.NVarChar,64),
new SqlParameter("@NativePlace",SqlDbType.NVarChar,128),
new SqlParameter("@Hobby",SqlDbType.NVarChar,65535),
new SqlParameter("@Others",SqlDbType.NVarChar,65535)
};
赋值:
param[0].Value = this.tbName.Text;
param[2].Value = this.pbPicture.ImageLocation;
param[3].Value = Convert.ToDateTime(this.dtpBirdate.Text);
param[4].Value = this.cbEduDeg.Text;
param[5].Value = this.tbTel.Text;
param[6].Value = this.tbQQ.Text;
param[7].Value = this.tbEmail.Text;
param[8].Value = this.cbProvince.Text + "-" + this.cbCity.Text + "-" + this.cbDistrict.Text;
param[9].Value = this.rtbLove.Text;
param[10].Value = this.rtbOthers.Text;
2.Combox
两个属性:DisplayMember (显示的值)和ValueMember(实际的值)
cbCity.DisplayMember = "CityName";
cbCity.ValueMember = "CityID";
3.PictureBox
Image属性
ImageLocation属性
4.OpenFileDialog
OpenFileDialog opd = new OpenFileDialog();
opd.InitialDirectory = @"F:\netstudy\work\resumeManage2\resumeManage\Resources";//初始的目录
opd.Filter = "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*";
opd.RestoreDirectory = true;
opd.FilterIndex = 0;
if (opd.ShowDialog() == DialogResult.OK)
{
imgpath = opd.FileName;
if (File.Exists(imgpath))
{
pbPicture.ImageLocation = imgpath;
}
}
SqlParameter[] param =
{
new SqlParameter("@Name",SqlDbType.NVarChar,32),
new SqlParameter("@Gender",SqlDbType.Int),
new SqlParameter("@Image",SqlDbType.NVarChar,65535),
new SqlParameter("@Birdate",SqlDbType.DateTime),
new SqlParameter("@Edudeg",SqlDbType.NChar,10),
new SqlParameter("@Tel",SqlDbType.Char,11),
new SqlParameter("@QQ",SqlDbType.VarChar,11),
new SqlParameter("@Email",SqlDbType.NVarChar,64),
new SqlParameter("@NativePlace",SqlDbType.NVarChar,128),
new SqlParameter("@Hobby",SqlDbType.NVarChar,65535),
new SqlParameter("@Others",SqlDbType.NVarChar,65535)
};
赋值:
param[0].Value = this.tbName.Text;
param[2].Value = this.pbPicture.ImageLocation;
param[3].Value = Convert.ToDateTime(this.dtpBirdate.Text);
param[4].Value = this.cbEduDeg.Text;
param[5].Value = this.tbTel.Text;
param[6].Value = this.tbQQ.Text;
param[7].Value = this.tbEmail.Text;
param[8].Value = this.cbProvince.Text + "-" + this.cbCity.Text + "-" + this.cbDistrict.Text;
param[9].Value = this.rtbLove.Text;
param[10].Value = this.rtbOthers.Text;
2.Combox
两个属性:DisplayMember (显示的值)和ValueMember(实际的值)
cbCity.DisplayMember = "CityName";
cbCity.ValueMember = "CityID";
3.PictureBox
Image属性
ImageLocation属性
4.OpenFileDialog
OpenFileDialog opd = new OpenFileDialog();
opd.InitialDirectory = @"F:\netstudy\work\resumeManage2\resumeManage\Resources";//初始的目录
opd.Filter = "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*";
opd.RestoreDirectory = true;
opd.FilterIndex = 0;
if (opd.ShowDialog() == DialogResult.OK)
{
imgpath = opd.FileName;
if (File.Exists(imgpath))
{
pbPicture.ImageLocation = imgpath;
}
}