A severe error has occurred - HELP!!!

D

Darin

I have done quite a bit of research on the web and it seems many people
get this same error, in different circumstances, and noone (including
Microsoft) seems to have a fix or be able to correct the problem.

My situation is I am writing a VB.NET application and would like the
user to be able to click on a button and it sets up replication. On the
command:

exec sp_addmergepublication @publication='SAMPLEmerge'

I receive an error:

A severe error has occurred on the current command. The results, if any,
should be discarded.

This is command works fine (perfectly) from query analyzer.

I have seen some threads that it says the SP has print commands and
remove those - this is a SQL supplied SP that has NO print commands
since query analyzer just returns the command completley successfully.

Does ANYONE have any solution to this problem.

Darin
 
M

Mary Chipman [MSFT]

Executing sp_addmergepublication in SQL Server requires membership in
the sysadmin or db_owner roles--does your client app connection string
satisfy these requirements? You don't mention what precisely the
"severe error" message is. Are you connecting to the publisher? Do you
have sufficient permissions? Are you supplying all of the necessary
arguments to the sproc? I'd suggest creating a Profiler trace and also
wrapping some SqlException handling around the call. BTW, the print
statement is specific to QA, not a part of T-SQL, and has no effect in
client code.

--Mary
 
D

Darin

Thanks for the response. My user (inxsql) is the DBO of the inware
database, and is marked for server roles as System Administrator.

I do have the SQLException wrapper as follows:

Try
strCommand = New SqlCommand(in_sql, xconn)
strCommand.CommandTimeout = 1800 '30 minutes
intOut = strCommand.ExecuteNonQuery()
xout = True
Catch oExcept As SqlException
Dim errorMessages As String
Dim i As Integer

For i = 0 To oExcept.Errors.Count - 1
errorMessages += "Index #" & i.ToString() & ControlChars.NewLine _
& "Message: " & oExcept.Errors(i).Message & ControlChars.NewLine _
& "LineNumber: " & oExcept.Errors(i).LineNumber & ControlChars.NewLine
_
& "Source: " & oExcept.Errors(i).Source & ControlChars.NewLine _
& "Procedure: " & oExcept.Errors(i).Procedure & ControlChars.NewLine
Next i

ShowError(errorMessages, "ExecuteSQL")
xout = False
Catch oExcept As Exception
ShowError(Mid(in_sql, 1, 50) & " - " & oExcept.Message, "ExecuteSQL")
xout = False
End Try

The Message line is only displaying the text about a sever error
occuring.

I did setup a profiler and notice one area:

sp_adddistributor was found in the text of this event, the text has been
replaced with this comment for security reasons.

My entire text, before the sp_addmergepulication does:

use master
exec sp_replicationdboption @dbname='InWare',etc
exec dbo.sp_helpditributor @rpcsrvname=@distributor OUTPUT
if @distributor is null
begin
declare @xpath varchar (255)
select @xpath=substring(filename,1,charindex('InWare_data',filename)-1)
FROM master..sysdatabases where name='inware'
exec sp_adddistributor @distributor=@@servername
exec sp_adddistributiondb @database='inxsqlDIST',etc
exec sp_adddistpublisher @publisher=@@servername, etc
end
exec sp_replicationdboption @dbname='InWare',@optname='merge
publish',@value='true'

I guess, now that I see Profiler has the line sp_adddistributor
commented out, this could cause the problem. What is commenting it out -
SQL or VB.NET?
Darin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top