'Using CONVERT:
MyCommand = New OleDbCommand("", MyConnection)
MyCommand.CommandText = String.Format("Select CONVERT(smallint, [Label Sequence:{0}].[PartInfo]) as pi, From [{0}] Inner Join [Label Sequence:{0}] On [{0}].[ID] = [Label Sequence:{0}].[ID]", s)
MyReader = MyCommand.ExecuteReader
'Using CAST:
MyCommand = New OleDbCommand("", MyConnection)
MyCommand.CommandText = String.Format("Select CAST([Label Sequence:{0}].[PartInfo] AS smallint) as pi, From [{0}] Inner Join [Label Sequence:{0}] On [{0}].[ID] = [Label Sequence:{0}].[ID]", s)
MyReader = MyCommand.ExecuteReader
'Using CAST (with a comma instead of AS):
MyCommand = New OleDbCommand("", MyConnection)
MyCommand.CommandText = String.Format("Select CAST([Label Sequence:{0}].[PartInfo], smallint) as pi, From [{0}] Inner Join [Label Sequence:{0}] On [{0}].[ID] = [Label Sequence:{0}].[ID]", s)
MyReader = MyCommand.ExecuteReader
|