none
Insert data voice RRS feed

  • Question

  • I want to insert data into sqlserver but when I click on each textbox such as: First Name, Last Name, Gender ... instead of typing, I finished reading and then press the insert button will save SQLServer, working on C # . thanks

    Monday, November 18, 2019 4:02 PM

All replies

  • Hi hoangluc19,

    Thank you for posting here.

    I am confused about your description. I am not sure what I can do for you.

    Could you please describe your problem in more detail?

    Looking forward to your reply.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, November 19, 2019 5:24 AM
  • Hi hoangluc19,

    Thank you for posting here.

    I am confused about your description. I am not sure what I can do for you.

    Could you please describe your problem in more detail?

    Looking forward to your reply.

    Best Regards,

    Timon



    Thank you very much. for example when entering data on software that works with computers. We add a new feature that is plugging headphones into the computer and reading data instead of sitting and typing continuously.


    Wednesday, November 20, 2019 2:00 AM
  • Hi hoangluc19,

    Thanks for your feedback.

    This is a question about speech recognition.

    This is a code example.

    using System.Globalization;
    using System.Speech.Recognition;
    using System.Windows.Forms;
    
    namespace SpeechToText
    {
        public partial class Form1 : Form
        {
            static CultureInfo ci = new CultureInfo("en-us");
            static SpeechRecognitionEngine sre =
              new SpeechRecognitionEngine(ci);
            public Form1()
            {
                InitializeComponent();
                sre.SetInputToDefaultAudioDevice();
                sre.SpeechRecognized += sre_SpeechRecognized;
                Grammar g_HelloGoodbye = GetHelloGoodbyeGrammar();
                Grammar g_SetTextBox = GetTextBox1TextGrammar();
                sre.LoadGrammarAsync(g_HelloGoodbye);
                sre.LoadGrammarAsync(g_SetTextBox);
            }
            static Grammar GetHelloGoodbyeGrammar()
            {
                Choices ch_HelloGoodbye = new Choices();
                ch_HelloGoodbye.Add("hello");
                ch_HelloGoodbye.Add("goodbye");
                GrammarBuilder gb_result =
                  new GrammarBuilder(ch_HelloGoodbye);
                Grammar g_result = new Grammar(gb_result);
                return g_result;
            }
            static Grammar GetTextBox1TextGrammar()
            {
                Choices ch_Colors = new Choices();
                ch_Colors.Add(new string[] { "red", "white", "blue" });
                GrammarBuilder gb_result = new GrammarBuilder();
                gb_result.Append("set text box 1");
                gb_result.Append(ch_Colors);
                Grammar g_result = new Grammar(gb_result);
                return g_result;
            }
            void sre_SpeechRecognized(object sender,
              SpeechRecognizedEventArgs e)
            {
                string txt = e.Result.Text;
                float conf = e.Result.Confidence;
                if (conf < 0.65) return;
                this.Invoke(new MethodInvoker(() =>
                {
                    listBox1.Items.Add("I heard you say: "
                  + txt);
                })); // WinForm specific
                if (txt.IndexOf("text") >= 0 && txt.IndexOf("box") >=
                  0 && txt.IndexOf("1") >= 0)
                {
                    string[] words = txt.Split(' ');
                    this.Invoke(new MethodInvoker(() =>
                    { textBox1.Text = words[4]; })); // WinForm specific
                }
            }
        } 
    }
    

    If you want to recognize other languages, you can add the language package in Settings -> Time and Language -> Speech.

    Hope this could be helpful.

    Best Regards,

    Timon



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, November 21, 2019 6:49 AM