PC Review


Reply
Thread Tools Rate Thread

Calling a stored procedure remotly

 
 
b_viehmann_Aachen
Guest
Posts: n/a
 
      4th Mar 2009
Hi,

i want to call a stored procedure remotly on a linked server with ado.net.
What i am doing in ironpython is this:

conn = SqlClient.SqlConnection(connectionString)
conn.Open()

action = SqlClient.SqlCommand("stopro_GetJobStatus", conn)
action.CommandType = CommandType.StoredProcedure

reader = action.ExecuteReader();
while reader.Read():
values = Array.CreateInstance( Object, reader.FieldCount)
reader.GetValues(values)
print(values)
self.results.append(values)

reader.Close()
conn.Close()

But i got an error message:

Traceback (most recent call last):
File "IpsPlusDbWatchDog.py", line 257, in IpsPlusDbWatchDog.py
File "IpsPlusDbWatchDog.py", line 129, in __init__
File "System.Data", line unknown, in ExecuteReader
File "System.Data", line unknown, in ExecuteReader
File "System.Data", line unknown, in RunExecuteReader
File "System.Data", line unknown, in RunExecuteReader
File "System.Data", line unknown, in RunExecuteReaderTds
File "System.Data", line unknown, in FinishExecuteReader
File "System.Data", line unknown, in get_MetaData
File "System.Data", line unknown, in ConsumeMetaData
File "System.Data", line unknown, in Run
File "System.Data", line unknown, in ThrowExceptionAndWarning
File "System.Data", line unknown, in OnError
File "System.Data", line unknown, in OnError
EnvironmentError: Login failed for user 'tasks'.

When I am trying this code with a query instead of a stored procedure
everything works fine.

So is it rigth that i have to change the configuration of the SQL-Server?
How?

BTW: I am using Win2003 Server and SQL-Server 2005.

Thanks much for your help..... :-)



 
Reply With Quote
 
 
 
 
Helmut Woess
Guest
Posts: n/a
 
      4th Mar 2009
Two things you can do:

always put this as first line into the stored proc:

SET NOCOUNT ON

and if you use table variables (i suppose you do if i see the error
message) then this should help:

IF 1 = 0 BEGIN
SET FMTONLY OFF
END

put it on the beginning of your stored proc. I know, normaly something
can't work, but try it...

bye,
Helmut
 
Reply With Quote
Reply

Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
calling stored procedure using c++ =?Utf-8?B?Qm95ZA==?= Microsoft Dot NET 0 17th Aug 2007 01:44 AM
calling stored procedure in ADO.NET 2.0 David Sagenaut Microsoft ASP .NET 1 24th Oct 2005 03:19 PM
calling a stored procedure in ADO.NET 2.0 David Sagenaut Microsoft C# .NET 1 24th Oct 2005 05:11 AM
Calling a SQL stored procedure =?Utf-8?B?RGF2aWQgRGF2aXM=?= Microsoft VB .NET 5 19th Nov 2004 06:28 PM
Calling a Stored Procedure in a Stored Procedure Group DJM Microsoft ADO .NET 1 21st Jan 2004 08:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:24 PM.