>In my VFP applications, I join fields together in many of my SQL statements using a VFP table. As such:
>
> SELECT mytable.field1, ALLTRIM(mytable.field2) + "-" + ALLTRIM(mytable.field3) AS mycolumn FROM mytable INTO CURSOR c_mycursor
>
>Is there any way to do something like this using Asp.Net and SQL Server?
I'd consider setting up a View in SQL Server. The view would have to be defined using Transact-SQL and its functions, but T-SQL has both LTRIM() and RTRIM() functions. So, you could do something like
CREATE VIEW MyView
AS
SELECT
Field1,
LTRIM(RTRIM(Field2)) + "-" + LTRIM(RTRIM(Field3)) AS MyColumn
FROM MyTable
The view is like a virtual Table, so from ADO.NET or any other client you would simply issue SELECT * FROM MyView ...
One nice thing about using Views is that if, later on, you need to tweak the formatting of its contents, you just do it in the view definition, rather than having to chase down all the places in your client code that manually build the columns the way you want them.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up