여기에 OCR을 수행하고 있습니다. 내 시스템에서는 사용자가 이미지, 문자 및 설명을 입력합니다.C# query database help
사용자가 동일한 문자 및 설명이있는 다른 이미지를 입력하려는 경우 사용자는 문자 및 설명이 동일하다는 것을 시스템에 알리기 위해 기존 문자를 가져와야 만 다시 입력 할 필요가 없습니다. 다시 문자와 설명.
누구나 어떻게 할 수 있는지 알고 있습니까?
con = new System.Data.SqlClient.SqlConnection();
con.ConnectionString = "Data Source=SHEN-PC\\SQLEXPRESS;Initial Catalog=CharacterImage;Integrated Security=True";
con.Open();
//set variables to the textbox.text
String ImageLocation = imgLoc.Text;
String typeName = CharTB.Text;
String ImportExt = importTB.Text;
String CharDesc = DescTB.Text;
String fileName = System.IO.Path.GetFileName(ImageLocation);
String savePath = @"C:\Users\Shen\Desktop\LenzOCR\LenzOCR\WindowsFormsApplication1\ImageFile\" + fileName;
inputImageBox.Image = Image.FromFile(ImageLocation);
inputImageBox.Image.Save(savePath);
String insertData = "INSERT INTO CharacterImage(ImageName, ImagePath, Character, CharacterDescription) VALUES('"+fileName+"', '"+savePath+"', '"+typeName+"', '"+CharDesc+"')";
SqlCommand cmd = new SqlCommand(insertData, con);
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Character Inserted", "Insert Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
descDisplayTB.Text = typeName + "\r\n\r\n" + CharDesc;
//set the Textbox to empty and the "Type Character" textboxt to uneditable
//and the "Import" button to unclickable after user add the data into the database
imgLoc.Text = "";
CharTB.Text = "";
importTB.Text = "";
DescTB.Text = "";
CharTB.ReadOnly = true;
ImportButton.Enabled = false;
}
private void button2_Click(object sender, EventArgs e)
{
descDisplayTB.Text = "";
pictureBox1.Image = null;
}
어떻게 할 수 있습니까? – joonshen