Showing posts with label aspnet. Show all posts
Showing posts with label aspnet. Show all posts

Monday, March 26, 2012

Problem with SQL in ASP.NET...

Hello,

I have the following SELECT statement I am using in asp.net page:

SELECT MonthName(Month([TransEntryDate])) AS MonthListed, Sum(Transactions.ListingPrice) AS SumOfListingPrice FROM Transactions GROUP BY MonthName(Month([TransEntryDate]));

I get the following error:

Undefined function 'MonthName' in expression.

This used to work with classic ASP, but I'm not sure how to form this to work with ASP.NET. I am using this because my results are showing months numerically and I'd like them to be returned with the actual month name (january, february, etc.)...

Any help would be greatly appreciated!MonthName is not a SQL Server keyword, its only support in Analysis Services. Is you .net project pointing to the same database as your classic asp?|||Yes pointing to same db... I'm not sure how to get the results I'm looking for though...|||Yes...pointing to same db, but not sure how to make this work for the results I need...|||I think that what I'm looking for is an example of how I could use the CASE Expression within my SELECT statement to return the month name (not the numeric value)... PLEASE HELP!!!!|||ah now why didn't you say so ;)


SELECT DATENAME(month, getdate()) AS 'Month Name'
|||I hate to be a pain...I'm new to this... Could you show me how to use this with my SELECT statement in my first post? Thank you!!!|||

SELECT DateName(month,[TransEntryDate]) AS MonthListed, Sum(Transactions.ListingPrice) AS SumOfListingPrice FROM Transactions GROUP BY [TransEntryDate]

NB Simply using "Group By" doesn't guarantee a sorted order.

Wednesday, March 21, 2012

Problem with SMO on a ASP.NET page

Hi !

I have done an EXE which copy a database using SMO. When i double click my exe everything is working fine. If i tried to execute my EXE in a ASP.NET web page the process is start but doesn't do anything. If i tried other EXE i've made it's working fine so the problem seems to come from SMO. Did i have something to add to my code if i want to use it in a webpage ?In common no, did you try to debug the SMO application / library which you wrote ?

HTH, jens Suessmeyer.

http://www.sqlserver2005.de|||

Thanks !

I've figure out what was the problem. To be able to use my EXE in my web application i've got to add those lines

myServer.ConnectionContext.LoginSecure = False

myServer.ConnectionContext.Login = "****"

myServer.ConnectionContext.Password = "*****"

Now my EXE is working fine when i'm calling it from my webapplication