2011-04-11 6 views
1

여기에 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; 
    } 

답변

0

다음 수 있음 단계가 작동 :

  1. 하는 이미지 ID가 [검색 할 수있다 또는 뭔가 다른] 어느 복사 할 것입니다 자세한 사항 입력하도록 사용자에게 물어 여기

    내 코드입니다 .
  2. 데이터베이스에서 해당 이미지의 세부 정보를 가져옵니다.
  3. 가져온 세부 정보가있는 새로 업데이트 된 이미지를 데이터베이스에 삽입하십시오.
+0

어떻게 할 수 있습니까? – joonshen

0

첫 번째 이미지를 입력 한 후 문자 및 설명 입력란을 삭제하지 않겠습니다. 그렇게하면 사용자는 다음 이미지를 선택하고 양식을 다시 제출해야합니다.

0

나는 당신에게 높은 수준의 대답을했습니다.

나는 최근에 인식되거나로드 된 데이터의 모음을 유지합니다. 그런 다음 각 항목이로드 될 때 데이터베이스에 최근 업로드 된 문자 이미지를 선택하기 위해 스크롤 창을 작성하여 사용자가 해당 항목을 교육 세트에 다시 연결할 필요가 없도록 할 수 있습니다.