Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# c查询数据库帮助_C#_Sql - Fatal编程技术网

C# c查询数据库帮助

C# c查询数据库帮助,c#,sql,C#,Sql,我在这里做光学字符识别。在我的系统中,用户输入图像、字符和描述 如果用户希望输入另一个具有相同字符和描述的图像,则用户只需导入现有图像,告知系统字符和描述相同,这样就不需要再次输入字符和描述 有人知道怎么做吗 这是我的密码: con = new System.Data.SqlClient.SqlConnection(); con.ConnectionString = "Data Source=SHEN-PC\\SQLEXPRESS;Initial Catalog=Char

我在这里做光学字符识别。在我的系统中,用户输入图像、字符和描述

如果用户希望输入另一个具有相同字符和描述的图像,则用户只需导入现有图像,告知系统字符和描述相同,这样就不需要再次输入字符和描述

有人知道怎么做吗

这是我的密码:

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;
    }

可能是以下步骤工作:

要求用户输入要复制其详细信息的图像id[可能是浏览或其他内容]。 从数据库中获取该图像的详细信息。 在数据库中插入新更新的图像和获取的详细信息。
输入第一张图像后,我不会清除字符和描述字段。这样,用户只需选择下一张图片,然后重新提交表单。

我为您提供了一个高级答案

我会收集最近识别或加载的数据。
然后,在加载每个项目时,您可以创建一个滚动窗口来选择最近上载到数据库的字符图像,这样此人就不需要将其与您的培训集重新关联。

您可以进一步解释如何执行此操作吗?