SQL query that works in SQL Server Management Studio, but doesn't on .NET 2.0 page

SELECT favorites.FID, favorites.filename, favorites.username, files.status, files.private, files.views, files.title FROM favorites INNER JOIN files ON favorites.filename = files.filename WHERE (favorites.username = @username) AND (files.status IS NULL) AND (files.private = @private)

@private is manually set to 'no'
@username is set to profile.username

when I run the above query in microsoft sql server mgmt studio express on the database, it presents all the information i'm asking for very easily. however when i try to implement this query on a aspx .net2.0 page with teh sqldatasource and a gridview, no data is displayed.

anyone know what my problem is?
 

0
orion846
2/21/2008 8:49:06 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies
1149 Views

Similar Articles

[PageSpeed] 15

Show us how you're doing it with the Grid, and the Datasource control


David Wier
MCP/ASPInsider
ASPNet101.com - where to look first!
Control Grouper - easily control properties for multiple controls with one control!
Calendar Express - The Best HTML Calendar Generator on the web!
(Please 'Mark as Answer' when it applies)
0
augustwind
2/21/2008 9:14:19 PM
Reply:

Similar Artilces:

SQL Server Reporting Services for SQL SERVER 2000 AND Visual Studio.NET 2005 .NET 2.0
Hi, Which version of SQl Server Reporting Services will work with SQL SERVER 2000 in pararrel with ASP.NET 2.0 (.NET 2.0 framework)?  Thanks, Azam HighOnCodingWanna get high! Hi, Okay I got the answer. Yes, we can use the SQL SERVER 2005 Reporting Services with SQL SERVER 2000. HighOnCodingWanna get high! ...

DNN 4.0 & .Net 2.0, SQL2005 (SQLExpress) with SQL Server Management Studio Express
Anyone have installation instructions for this configuration:WinXP, IIS 5.1, .Net 2.0 (release), SQL2005 (SQLExpress) release...without VisualStudio 2005? Using SQLSMSE for database creation?Every attempt I make appears to succeed, but viewing the databasein SQLSMSE shows no stored procs, etc. in the db. Sometimes thecore modules are installed / available, sometimes they're not.Is it related to the file attachment in web.config?Could this have something to do with the 'file manager is unavailable'and 'cannot open a closed file' errors people have been reporting?Kirk...

This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers
When I connect SQL Server 2005 to a remote database i get the error: "This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers". Can I confirm it is because: the remote db is of SQL Server 2008? There is a soln mentioned in http://forums.asp.net/t/1324047.aspx Did anybody try this (installing 2008 express: http://www.microsoft.com/express/sql/download/)? I am just checking again, whether it will disturb my existing SQL Server installation, in any means...? Though it is mentioned that it will g...

Can't connect to SQL 2005 Express with SQL Server Management Studio Express
I've seen the following error posted when people try to connect to their server via their applications but didn't see anyone having problems when trying to connect with SQL Server Management Studio Express. Am I missing something here? This is the error:<<An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)(Microsoft SQL Server, Erro...

SQL Server 05 & .NET .dll's: executing .dll from T-SQL
Can I manually execute a .dll stored in SQL Server 2005?Is it possible for this .dll to do anything: call a Web Service, process XML, etc?Thanks. ...

SQL Server 2005 Connection doesn't work on the Server #2
I have the same problem as the other post with the same subject, but the solutions in that thread has not worked for me, and I have not figured out the solution. I am running SQL Server 2005 on my win64 box. REMOTELY: I can run my app and remotely connect successfully to the server's database from my winXP box. LOCALLY: With the same database name, password, and login, (server name changed to 127.0.0.1 instead of win64) I can use Microsoft SQL Server Management Studio to connect to the server on the win64 box. HOWEVER, if I try and run the app on the win64 box (with the same databa...

DNND4.0 on Sql server 2005:Throw sql server2005 doesn't allow Remote connection~~How to setup it ?
DNND4.0 on Sql server 2005:Throw sql server2005 doesn't allow Remote connection~~How to setup it ?...

Session Management in SQL SERVER for .NET 2.0
Hi, I need to maintain Session variables in the Sql Server Database. But for maintaining the Session, the aspnet_regsql.exe must be run in the .net 2.0 framework. I have a clarification on running aspnet_regsql.exe in asp.net 2.0 I have a Web Server 'TESTWEB' where my source code resides. The Database server resides in another server. The exe must be run in the command prompt from C:\Windows\Microsoft.Net\Framework\v2.0\mentioning the parameters as Database server name, User id, Password. But the doubt is, whether this exe must be run only from this web server 'TESTWEB'...

problem with Visual Studio 2008, Net Framework 2.0 and AJAX 1.0 doesn't work!
I wrote simple web application with update panel but when I loaded application, update panel didn't work..I think It's problem with AJAX 1.0... How to fix this problem???ASP.NET 3.5VISUAL STUDIO 2008 PROMS SQL SERVER 2005 You really need to be more specific about what you're trying to do, what's happening, post your source code, something...When you ask a question, remember to click "mark as answered" when you get a reply which answers your question.My latest ASP.NET AJAX blog entries. I have side by side installed visual studio 2005 and 2008.In visual studio ...

'Too many characters' error in sql string
Hello i constructed the following query in SQL management studio and it runs fine, exactly how i want it to. However when i run it in my code behind i get the error: 'Too many characters in character literal' I desperatly need to use this query exactly how it displays in the mangement tool - why wont it work the same in my code behind? (I am using c# in my code behind and binding the results of the query to a gridview) Regards "SELECT DISTINCT (dbo.AuthorList(publicationID))+ ';' + ISNULL(' Editor: '+Publication.editor, '')+ '' + ISNULL...

Result set paging .net 2.0 and sql server
 Hi,I'm wondering how to convert the following into a pageable data set..here's my current stored procedure:  1 DECLARE @SQL varchar(1000) 2 3 SET @SQL ='SELECT * from tablen n left join 4 Projects p on p.id = n.id left join projectindividuals pi on p.projectid=pi.projectid 5 left join tabled d on d.id=pi.id 6 where d.isDeleted = 0' 7 8 IF @Id <> 0 9 BEGIN 10 SET @SQL = @SQL + ' and p.Id=' +Cast(@Id as char) 11 END 12 13 IF @Gender <> '' 14 BE...

SQL server management studio for SQL server 7 ??
 Hi, I have a Client using SQL server 7 and we want to access this database.However Server Management studio(on 2005) does not like the Server 7. Have  you got any suggestion to me? Best Regard You can go to Start ==> Run ==> Type MMC In MMC Select File ==> Add Remove Snapin ==> Add 'Select SQL Server' I hope this may work.Please remember to click “Mark as Answer” on the post that helps youBest RegardsBrij Mohanhttp://www.dotnetglobe.com That doesnt work. The database is hosted in a remote location.And I need a database client tools for the...

BCP of 4.9.2 SQL Server to 11.0.2 SQL Server
We have a client wishing to bcp data out of a 4.9.2 SQL Server database and bcp the data into an 11.0.2 SQL Server database. Just knowing of the problems that have arisen lately with regards to the System 11 bcp utility and the fact that 4.9.2 is such an old release, is the above task possible? If not, what is my alternative? Regards, -- Robert C. Marx SQL Financials International 770.291.8506 MarxR@SFI.com Rob Marx wrote: > > We have a client wishing to bcp data out of a 4.9.2 SQL Server database and > bcp the data into an 11.0.2 SQL Server database. Ju...

T-SQL TRIGGER causes crash in .Net, Interactive SQL works...?
Hi All I am fairly new to Sybase databases. I have a database with a single table (AdressenStorage) to that table I added (T-SQL)triggers for INSERT, UPDATE and DELETE. Everything works fine with InteractiveSQL. But as soon as I execute the statements from my .Net application, it crashes. (The program hangs at cmd.ExecuteNonQuery() ). I removed all triggers and everything worked fine. Right now I have just the (reduced) INSERT trigger (which still crashes): CREATE TRIGGER "AdressenStorage_Insert" on DBA.AdressenStorage for insert as begin -- Handle RevIsCurrent ...

Web resources about - SQL query that works in SQL Server Management Studio, but doesn't on .NET 2.0 page - asp.net.sql-datasource

Resources last updated: 1/2/2016 5:44:52 PM