大家好,你能帮我解决这个错误 当我插入数据库时,会出现Message框 那说
"从对象类型到已知对象不存在映射 System.Windows.Forms.Textbox本机托管提供程序类型"
和错误 哪里有错误代码? 因为我刚刚完成移动旧数据库并因为数据类型错误
而创建了一个新数据库我有一些代码插入照片
private void button2_Click(object sender, EventArgs e)
{
lblRightorFalse.Text = "False";
try{
string dProduksi = DateTime.Parse(dtmProduksi.Text).ToString("yyyy-MM-dd");
byte[] image = null;
FileStream fs = new FileStream(this.txtLink.Text, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
image = br.ReadBytes((int)fs.Length);
con.Open();
cmd = new SqlCommand("insert into Produksi (IDProduksi,TanggalProduksi,NamaKaryawan,KeteranganPhoto,Photo,Verifikasi,IDPhoto,Jenis_Kanvas,Ukuran_Photo) Values(@IDProduksi,@TanggalProduksi,@NamaKaryawan,@KeteranganPhoto,@Photo,@IDPhoto,@Jenis_Kanvas,@Ukuran_Photo)", con);
cmd.Parameters.AddWithValue("@IDProduksi", txtIdpro.Text);
cmd.Parameters.AddWithValue("@IDPhoto", txtIdPhoto.Text);
cmd.Parameters.AddWithValue("@TanggalProduksi", dProduksi);
cmd.Parameters.AddWithValue("@NamaKaryawan", txtNamaKaryawan.Text);
cmd.Parameters.AddWithValue("@KeteranganPhoto", rxtKtrphoto.Text);
cmd.Parameters.AddWithValue("@Photo", image);
cmd.Parameters.AddWithValue("@Verifikasi",lblRightorFalse.Text);
cmd.Parameters.AddWithValue("@Jenis_Kanvas", txtJenisKertas.Text);
cmd.Parameters.AddWithValue("@Ukuran_Photo", txtUkuranPhoto);
cmd.ExecuteNonQuery();
MessageBox.Show("Insert telah di jalankan");
con.Close();
showgridview();
clear();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} // insert button