DataTable Select Method
-
In ADO.NET I am able to create an array of DataRows that match my criteria, but only when cboSponsor.Text contains one word. If there is more than one word I get an error message when I am debugging. ------------------------------------------------------------- Code: Dim drFound() As System.Data.DataRow Dim dr As System.Data.DataRow drFound = Me.DsEvent1.EventTbl.Select("OrgName = " & cboSponsor.Text) ------------------------------------------------------------- Error message: An unhandled exception of type 'System.Data.SyntaxErrorException' occurred in system.data.dll Additional information: Syntax error: Missing operand after 'Helpers' operator. ------------------------------------------------------------- In this case, 'Helpers' is the second of two words. How can I code it so it recognizes a phrase? Thanks
-
In ADO.NET I am able to create an array of DataRows that match my criteria, but only when cboSponsor.Text contains one word. If there is more than one word I get an error message when I am debugging. ------------------------------------------------------------- Code: Dim drFound() As System.Data.DataRow Dim dr As System.Data.DataRow drFound = Me.DsEvent1.EventTbl.Select("OrgName = " & cboSponsor.Text) ------------------------------------------------------------- Error message: An unhandled exception of type 'System.Data.SyntaxErrorException' occurred in system.data.dll Additional information: Syntax error: Missing operand after 'Helpers' operator. ------------------------------------------------------------- In this case, 'Helpers' is the second of two words. How can I code it so it recognizes a phrase? Thanks
-
try
drFound = Me.DsEvent1.EventTbl.Select("OrgName = '" & cboSponsor.Text&"'")
Work hard and a bit of luck is the key to success.
You don`t need to be genius, to be rich.