| | |
Smo.StoredProcedure Help!
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2008
Posts: 36
Reputation:
Solved Threads: 0
Hello all,
I want to create a stored procedure using SMO Objects. I have set up all the properties of my Smo.StoredProcedure object, but when i try to create it, it throws me this Exception Message:
Here's a little snippet of my code:
I want to create a stored procedure using SMO Objects. I have set up all the properties of my Smo.StoredProcedure object, but when i try to create it, it throws me this Exception Message:
Microsoft.SqlServer.Management.Common.ExecutionFailureException: An exception occurred while executing a Transact-SQL statement or batch Here's a little snippet of my code:
protected void btnCreateNewSP_Click(object sender, EventArgs e)
{
StoredProcedure sp = (StoredProcedure)Session["SP"];
sp.TextBody = txtSqlStatement.Text;
try
{
sp.Create();
lblErrorInfo.ForeColor = System.Drawing.Color.Green;
lblErrorInfo.Text = "Stored Procedure has been successfuly created!";
}
catch (Exception ex)
{
lblErrorInfo.ForeColor = System.Drawing.Color.Red;
lblErrorInfo.Text = ex.Message + " Error Info: " + ex.InnerException.Message;
}
}•
•
Join Date: Jun 2009
Posts: 433
Reputation:
Solved Threads: 82
Hi Alexpap ,
Post the complete error message. Becuase the error message that you posted is generic for SMO object.
Also Check the following things:
1. Database connection is estabilished before executing 'Create' method for StoredProcedure object by putting a break point.
2. sp.TextBody has correct syntax.
Post the complete error message. Becuase the error message that you posted is generic for SMO object.
Also Check the following things:
1. Database connection is estabilished before executing 'Create' method for StoredProcedure object by putting a break point.
2. sp.TextBody has correct syntax.
![]() |
Similar Threads
- How can i serialize this object? (ASP.NET)
- Run SSIS Package from VB 2005 / SMO? (MS SQL)
- asp .net & vb .net html rich text editor (ASP.NET)
- C# failing to drop stored procedure from SQL Server using SMO (C#)
- Working with SQL server's Image data type (ASP.NET)
- Simple ASP.Net Login Page (Using VB.Net) (ASP.NET)
- Working with SQL's Text data type (ASP.NET)
- ADO.NET Specified cast is not valid (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: Binding Data to text box
- Next Thread: How can i serialize this object?
| Thread Tools | Search this Thread |
.net 2008 access activedirectory advice array asp asp.net avltree broadcast c# c++ combobox concurrency connection console control cs4 custom data database datagrid datagridview datastructure datetime dba dbconnection developer development directrobot dll dubai e-commerce editor enabled error excel file form formatting formbox gdi+ httpwebrequest index keypress label linux lisp list listview login mailmerge marshalbyrefobject math mdd mono msword mysql operator path photoshop php pointer post print programming remote remoting reporting resourcefile richtextbox server silverlight softwaredevelopment sql sql-server statistics string stringformatting study tables text textbox totaldays treeview uploadatextfile user validate validation vb video visual-studio visualstudio webdevelopemnt whileloop wia windows winforms wpf write






