MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old April 13th, 2004, 10:43 AM
aniaahh aniaahh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: poland
Posts: 88 aniaahh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 39 sec
Reputation Power: 5
stored procedure problem...

hi
i've got this problem.
here's the stored procedure i've written :

CREATE PROCEDURE Logowanie @login varchar(10), @znal varchar(10) output AS
select haslo from konta
where login = @login
GO

now : when executed in sql query analyzer, it works fine and returns what it should. but when called from an application
( like c# ) it always returns null. i think it may have something to do with binding the returned value with the output parameter.

can anyone correct the syntax?

any help will be appreciated
__________________
ania

Reply With Quote
  #2  
Old April 13th, 2004, 08:29 PM
punkisdead's Avatar
punkisdead punkisdead is offline
Moron
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Michigan, USA
Posts: 170 punkisdead User rank is Private First Class (20 - 50 Reputation Level)punkisdead User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 31 m 37 sec
Reputation Power: 6
Quote:
Originally Posted by aniaahh
hi
i've got this problem.
here's the stored procedure i've written :

CREATE PROCEDURE Logowanie @login varchar(10), @znal varchar(10) output AS
select haslo from konta
where login = @login
GO

now : when executed in sql query analyzer, it works fine and returns what it should. but when called from an application
( like c# ) it always returns null. i think it may have something to do with binding the returned value with the output parameter.

can anyone correct the syntax?

any help will be appreciated


You never set your output variable to anything

try this on for size....

CREATE PROCEDURE Logowanie @login varchar(10), @znal varchar(10) output AS
select @znal = haslo from konta where login = @login

GO

Reply With Quote
  #3  
Old April 14th, 2004, 05:24 AM
aniaahh aniaahh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: poland
Posts: 88 aniaahh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 39 sec
Reputation Power: 5
heh

yeah i tried that
but then - when i test the procedure in query analyzer it does not return any values even though it should.

Reply With Quote
  #4  
Old April 14th, 2004, 09:52 AM
punkisdead's Avatar
punkisdead punkisdead is offline
Moron
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Michigan, USA
Posts: 170 punkisdead User rank is Private First Class (20 - 50 Reputation Level)punkisdead User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 31 m 37 sec
Reputation Power: 6
What is the query you are using to execute the stored procedure?

i.e.

declare @znal varchar(10)
exec Logowanie 'Login', @znal output
select @znal

Reply With Quote
  #5  
Old April 14th, 2004, 10:09 AM
aniaahh aniaahh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: poland
Posts: 88 aniaahh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 39 sec
Reputation Power: 5
hmm

well

i call stored procedure from C# application.
there - when i pass the exact values ( like "login") to the procedure - it works perfect. but when i try to get the textbox.text value to pass it as input parameter to the stored procedure - it doesnt work.
so i guess the procedure's all fine. it's the textbox.text that does not seem to work.

cheers and thx for your effort.

Reply With Quote
  #6  
Old April 14th, 2004, 10:41 AM
punkisdead's Avatar
punkisdead punkisdead is offline
Moron
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Michigan, USA
Posts: 170 punkisdead User rank is Private First Class (20 - 50 Reputation Level)punkisdead User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 31 m 37 sec
Reputation Power: 6
I would post this question in the .net forum since it looks like your SQL is correct. It looks like your c# syntax might be wrong...

Reply With Quote
  #7  
Old April 14th, 2004, 10:50 AM
aniaahh aniaahh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: poland
Posts: 88 aniaahh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 39 sec
Reputation Power: 5
yeah

yeah i allready did
thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > stored procedure problem...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway