Groups | Blog | Home
all groups > vb.net data > december 2004 >

vb.net data : "Syntax Error or Access Violation" ???


scott.shelbourne NO[at]SPAM gmail.com
12/1/2004 2:55:06 PM
I'm getting a "Syntax error or access violation" error when I try to
run a SQLServer stored procedure from my ASP.NET application. I can
run the same exact procedure from Query Analyzer with no problems. I
have checked the security permissions on SQLServer and have ensured
this user has db_owner rights. The strange thing is that if I run a
stored procedure via the code that does a Select query it is fine.
However, this one procedure I'm trying to run performs an Insert and
it blows up.

Does anyone have a clue at what I can look for with this problem? It
has me baffled. The code I'm using is below. It dies when it gets to
the ExecuteNonQuery call.

<code>
Function ExecuteOLEDBStoredProcNonQuery() As Long
Dim _connection As New OleDb.OleDbConnection(_DSN)
Dim _command As New OleDb.OleDbCommand(_SQL, _connection)
With _command
.CommandType = CommandType.StoredProcedure
_connection.Open()
.ExecuteNonQuery()
.Dispose()
End With
With _connection
.Close()
.Dispose()
End With
End Function
lishil NO[at]SPAM online.microsoft.com
12/11/2004 12:19:31 AM

(1) Be sure specify the owner name, when you run the procedure.
OR
(2) try
sp_MSobjectprivs on the procedure and the table, to see if your right is
denied.

Lish Liui, VSData


--------------------
[quoted text, click to view]
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwi
x.com!newsfeed.cwix.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news
.glorb.com!postnews.google.com!not-for-mail
[quoted text, click to view]
AddThis Social Bookmark Button