|
Hi guys,
I am executing a stored procedure from my webservices, i would like this store procedure to check is a userid exist and if it does then i would like to return a value saying so.
Here is a quick proc...i don't know how to carry on from here.
USE [reportserver]
GO
--Create the Procedure
CREATE PROCEDURE FindCurrentUser(@userid VARCHAR(10), @RowCount VARCHAR(10) output)
AS
BEGIN
IF EXISTS(SELECT * FROM [UserProfile] WHERE [userid] = @userid)
BEGIN
RETURN @RowCount = 'Exists'
END
ELSE
BEGIN
RETURN @RowCount = 'NotExists'
END
END
but it gives me an error:
'Incorrect syntax near '='
Any help please??
Thanks,
Morg
|
|
|
|
|
Here's one way:
USE [reportserver]
GO
--Create the Procedure
CREATE PROCEDURE FindCurrentUser(@userid VARCHAR(10))
AS
BEGIN
declare @RowCount varchar(10)
IF EXISTS(SELECT * FROM [UserProfile] WHERE [userid] = @userid)
BEGIN
set @RowCount = 'Exists'
END
ELSE
BEGIN
set @RowCount = 'NotExists'
END
select @RowCount as Counter
END
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
Thanks man,
that was great help
|
|
|
|
|
I wouldn't use rowCount since it is a reserved word. Also I think you are making it more difficult on yourself by requiring hard coded strings. Hard coded strings for program control flow are bad. All you need is this:
select count([userid]) from [userprofile] where [userid]=@userID
Then in your C# you can just check for > 0.
|
|
|
|
|
Hi All ,
I want to run schedule task in every 1 min in background in asp.net but it should not interfere the other operation of application.
I tried with the following option
<a href="http://www.codeproject.com/KB/aspnet/ASPNETService.aspx"></a>
and it seems it is not working.can u guys provide me any solution or any sample.
Thanks and regards,
Amit Patel
|
|
|
|
|
Search about thread or timer and you will get something in google and start it in Application_Start method
|
|
|
|
|
Dont know why it was downvoted... direction is fine! gave a 5 to balance out..
|
|
|
|
|
I am using Server.Transfer to navigate between my ASP.Net 3.5 pages. The URL changes each time I go to a new page. How do I prevent the querystring from changing no matter what? In other words, I want the URL to always display the default.aspx page no matter what page I am on.
Thanks.
Adam
|
|
|
|
|
|
Hi I want to add masterpage to my existing project It Has 200 forms..
please Help.
|
|
|
|
|
Ok, so add it. What difficulties or questions do you have?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
You have to do that manually for all of them.
First you have add the following code as follows:
1. Mention the Master Page File path in the Page Directory
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default1.aspx.cs" Inherits="Default1" Title="Untitled Page" %>
2. Then add the content place holder code next to the page declarative code.
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<!-- ContentPlaceHolderID Should match master pages's ContentPlaceHolder's IDRest of your html markups, including Server Controls goes here. -->
<asp:Content>
3. Then remove HTML tags from up to tag
P.S.: Be sure that you do not have a runat=server in form tag anymore. (because master page form tag contain the runat=server attribute.)
This way you can make the existing page to the master paged one.
|
|
|
|
|
Dear all,
I have a dedicated server where I used to publish the project developed in asp.net.
Somebody deletes all source code from server. I cound not find any information of them either in IIS log or FTP log.
Any body can help me please how I can detect who is doing this hell.
I am very disappointed with such activity.
Thanks
Rohit
|
|
|
|
|
Who manages the server? Did you ask them? (if it wasn't you!)
Try changing the password/s that allow access to the web source.
I'd start there (assuming you've checked for trojans, key loggers, etc, etc).
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
Thanks dear for your suggestion. I did all thing even I bought a new server even though same thing is happening there. One thing I would like to ask is it possible to delete all project related files from server via http injection as I found some suspecious request in IIS log file like /cgi-bin/env.pl, /fastenv etc.
Hoping some answer from you
|
|
|
|
|
Rohit16db wrote: I bought a new server
If you can buy a new server for this, I guess you should hire a professional for maintaining your servers.
..Go Green..
|
|
|
|
|
Yes, Http Injections can do it!
|
|
|
|
|
Hi...
In my asp.net form ,if form view is not binding no records ,it should show empty datatemplate ,i am not getting the empty data template ..
can any one send me the sample code...
-- Modified Tuesday, May 18, 2010 7:00 AM
|
|
|
|
|
Best would be when no records fetched to bind, then add a dummy blank row to show the template with header.
Check the rowcount before binding, if it's zero then add the above logic.
|
|
|
|
|
I am using Lightbox jquery in my project.When I am clicking Image it shows me the image in light box properly but at the same my menu items are clickaable when is taken on them.
Please provide me solution
|
|
|
|
|
I'm not 100% sure what you mean with "menu items are clickaable when is taken on them", but i guess, the menu is not hidden behind the shown image?
This has something to do with the z-index of the involed divs/panels/etc.
So you have to make sure that your menu-divs' (or whatever your menu consists of) have lower z-indeces than the elements displaying the image.
This is just a guess though.
modified on Tuesday, May 18, 2010 6:48 AM
|
|
|
|
|
Dear all,
I have to make a webservice that gets some data as parameter from the client and saves these into a database.
My question is what is the best way to make this? in wich format has to be the data? can i use a datatable/dataset? or each record separatly? or other ways?
the amount of records is each time various(till 2000 records).
Thanks in advance.
|
|
|
|
|
|
Can anyone please help me with the following exception.
Exception Type: System.Data.SyntaxErrorException
-----------------------------------------------------------
Message: Syntax error: Missing operand after 'V' operator.
-----------------------------------------------------------
Data: System.Collections.ListDictionaryInternal
TargetSite: System.Data.ExpressionNode Parse()
HelpLink: NULL/Undefined
Source: System.Data
what is a 'V' operator ?? how shld i proceed about fixing this ??
thanks
|
|
|
|
|
Can you share the details on what you are doing and the section which is raising this error?
|
|
|
|