Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
potn1
Starting Member
33 Posts |
Posted - 2009-10-06 : 13:49:20
|
| Hi so I am executing a query in SQL Server management studio and I am able to pull the exact data I am looking for using this:SELECT TITLE, ARTICLEID, VIDEOARCHIVED, SUMMARY, DATE, NAME,SUBSTRING(TITLE,1,1) AS 'BREAK' from preps.dbo.ArticleINNER JOIN preps.dbo.Author ON Article.AuthorID = Author.AuthorIDWHERE (preps.dbo.Article.Deleted <> 1 OR preps.dbo.Article.Deleted IS NULL) AND (CATEGORYID IS NOT NULL OR CATEGORY2ID IS NOT NULL)I then bring this over to our actual website in our ascx.cs file to run the query append and it just seems to crash:strQuery.Append("SELECT TITLE, ARTICLEID, VIDEOARCHIVED, SUMMARY, DATE, NAME, ");strQuery.Append("SUBSTRING(TITLE,1,1) AS 'BREAK'");strQuery.Append(" from Article ");strQuery.Append(" INNER JOIN Author ON Article.AuthorID = Author.AuthorID ");strQuery.Append(" WHERE (Article.Deleted <> 1 OR Article.Deleted IS NULL) AND (Article.CATEGORYID IS NOT NULL OR Article.CATEGORY2ID IS NOT NULL)");Does anyone have any idea where my issue would be coming from? Any help is appreciated. Thanks! |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
potn1
Starting Member
33 Posts |
Posted - 2009-10-06 : 14:48:38
|
| I've already got this statement in our ascx.cs:strQuery.Append("SELECT TITLE, ARTICLEID, VIDEOARCHIVED, SUMMARY, DATE, ");strQuery.Append("SUBSTRING(TITLE,1,1) AS 'BREAK'");strQuery.Append(" from Article ");strQuery.Append(" WHERE (Article.Deleted <> 1 OR Article.Deleted IS NULL) AND (Article.CATEGORYID IS NOT NULL OR Article.CATEGORY2ID IS NOT NULL)");So I figured I could just SELECT 'Name' and then JOIN the Author and Article table by AuthorID since the 'Name' column is located in the Author table.. |
 |
|
|
|
|
|
|
|