7
我有一個SQL數據庫應用程序,我想結合了語音搜索功能。我已經知道如何搜索數據庫,但我不知道如何從數據庫中的表中創建語法。這是我的代碼到目前爲止。語音識別在SQL數據庫VB.net
Dim WithEvents reco As New Recognition.SpeechRecognitionEngine
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
reco.SetInputToDefaultAudioDevice()
Dim gram As New Recognition.SrgsGrammar.SrgsDocument
Dim RecipeRule As New Recognition.SrgsGrammar.SrgsRule("recipe")
Dim colorsList As New Recognition.SrgsGrammar.SrgsOneOf(DataSet1.Table.ToString)
RecipeRule.Add(colorsList)
gram.Rules.Add(RecipeRule)
gram.Root = RecipeRule
reco.LoadGrammar(New Recognition.Grammar(gram))
reco.RecognizeAsync()
End Sub
Private Sub reco_RecognizeCompleted(ByVal sender As Object, ByVal e As System.Speech.Recognition.RecognizeCompletedEventArgs) Handles reco.RecognizeCompleted
reco.RecognizeAsync()
End Sub
Private Sub reco_SpeechRecognized(ByVal sender As Object, ByVal e As System.Speech.Recognition.RecognitionEventArgs) Handles reco.SpeechRecognized
Try
Me.TableTableAdapter.Recipe(Me.DataSet1.Table, e.Result.Text & "%")
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub
我需要在DataSet1.Table中的配方行中使項目成爲語法。