Showing posts with label enter. Show all posts
Showing posts with label enter. Show all posts

Friday, March 30, 2012

Invokation of a stored procedure from an Integration Services package

Is it possible to execute a stored procedure from an Integration Services package? I see that its possible to enter sql commands that can be run but when a command to execute a stored procedure is entered the system cannot find the stored procedure (eventhough 'use mydbname' preceded it.

thx,

Marilyn

You certainly can execute a stored procedure, but we'll need some more information to help.

Are you using the Execute SQL task in SSIS? Is the database SQL Server? Does the account your are developing under have permissions to see the stored procedure? What error messages are you seeing?

Donald

Friday, March 23, 2012

Invalid object name please help

When i enter http://akor.alternatifim.com/
i get the error below

Microsoft OLE DB Provider for ODBC Drivers error '80040e37'

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'tblSARKICIM'.

The SQL statement is so simple like

Select * from tblSARKICIM

However when i change the SQL statement Select * from lyric.tblSARKICIM

lyric is username and owner of the tables.

Problem is solved. I transfer the My SQL Server and then this problem occurs and i don't want change all my SQL statements.

What can i do?Going to need to see the code.|||Can I ask, why does anyone feel the need to create database objects under any owner other than dbo?

I've always seen it cause more trouble than it's worth.

And if you want tables with the same name, why not just create another database?|||I am running that SQL Server with hosting firm, and can not see user of dbo.
What can i do for that? If administrators give Database Creators privilage to user lyric, is the problem solved? Or i need to change the owner of the tables to dbo?

I don't think there is a wrong with the code, because it was running without problem before transfering db.

Thanks for your helps.|||then the only work around is to instruct your web application (as I can see) to connect to the database server with that user (lyric) credentials.

This is the way that SQLServer works: when you specify an incomplete object qulificator (eg. DBname.Owner.ObjectName), then SQL first tries with current db, and current user as a default. Then switch to dbo (in place of owner). If all tose failed, then an exception of "Invalid object name ..." is thrown.

So if all your objects have the lyric user as their owner, you have two options to query them:

First: select * from lyric.tbl1 (works for any authenticate user that has select permissions on that tbl1 table) or,

Second: select * from tbl1 (works only if the current user is lyric)|||then the only work around is to instruct your web application (as I can see) to connect to the database server with that user (lyric) credentials.

This is the way that SQLServer works: when you specify an incomplete object qulificator (eg. DBname.Owner.ObjectName), then SQL first tries with current db, and current user as a default. Then switch to dbo (in place of owner). If all tose failed, then an exception of "Invalid object name ..." is thrown.

So if all your objects have the lyric user as their owner, you have two options to query them:

First: select * from lyric.tbl1 (works for any authenticate user that has select permissions on that tbl1 table) or,

Second: select * from tbl1 (works only if the current user is lyric)

DB owner is lyric and if i perform the query with lyric.name_of_table it runs without any errors. However changing all query user_name.table_name will be very difficult for me.
For that reason, i want to use query like select blah blah from tbl1 not lyric.tbl1

Is there a way to determine and change the current user? Or i need to change the owner of the table. And What will be do if administrator give lyric to Database Creators privilage (Server Role)

Thanks for your help|||I use that command and change the owner of the db lyric to dbo
And it is working now, thanks for your help :)

EXEC sp_changeobjectowner 'lyric.tblSARKICIM', 'dbo'

Invalid object name dbo.aspnet_SchemaVersions - what did I ever do to you?

environment: asp.net 2.0, vb, sql server 2000, windows server 2003.

Currently when I try to test to enter information through a CreateUserWizard this error pops up, I have checked my databases and I do have a aspnet_SchemaVersion there, I checked around the net and on the forums and I fixed any problems I thought could be causing it, I gave network services rights, as well as my sql server login, I have both a membership and a schemaversion table in the database.

I ran aspnet_regsql.exe to make a new target for my <forms> login, I just don't see what the problem is and can't seem to find anything out there that is the same as my problem. The following is the web.config:

<configuration>
<appSettings>
<add key="ConnectionString" value="DataSource=mew@.mew.com;UID=mew;pwd=mewmew" />
<add key="ConnectionString" value="Server=xxxxxxxxxx;database=customerlogin;UID=xxxxxxxxx;pwd=xxxxxxxx;Trusted_Connection=True" />
</appSettings>
<connectionStrings>
<add name="SqlServerConnection" connectionString="Server=xxxxxxxxxx;database=customerlogin;UID=xxxxxxxxxx;pwd=oni@.ichi;Trusted_Connection=True" />
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=xxxxxxxxxx;Integrated Security=SSPI;Initial Catalog=customerlogin;UID=xxxxxxxxx;pwd=xxxxxxxxx;Trusted_Connection=True" />
</connectionStrings>
<location path="secret">
<system.web>
<webParts>
<personalization defaultProvider="MyPersonalizationProvider">
<providers>
<membership defaultProvider="MyMembership">
<add name="MyMembership" type="System.UI.WebControls.WebParts.SqlPersonalizationProvider" connectionStringName="SqlServerConnection" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" requiresPassword="false" />
</membership>
</providers>
<authorization>
<deny users="?" />
</authorization>
</personalization>
</webParts>
<authentication mode="Forms" />
</system.web>
</location>
</configuration>

and this is the register.aspx page:

<%@. Page Explicit="true" debug="true" language="vb" %>
<%@. Import Namespace="System.Data" %>
<%@. Import Namespace="System.Data.SqlClient" %>
<%@. Import Namespace="System.Data.Mail" %>
<%@. Import Namespace="System.Net.Mail" %>
<%@. Import Namespace="System.Web.Configuration" %>

<script runat="server">
Sub Page_Load()
If Not Page.IsPostBack Then
Dim dest As String = "~/Default.aspx"
If Not String.IsNullOrEmpty(Request.QueryString("ReturnURL")) Then
dest = Request.QueryString("ReturnURL")
CreateUserWizard1.ContinueDestinationPageUrl = dest
End If
End If
End Sub

Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As EventArgs)
CreateUserProfile(CreateUserWizard1.UserName, txtFirstName.Text, txtLastName.Text)
End Sub

Private Sub CreateUserProfile(ByVal userName As String, ByVal firstName As String, ByVal lastName As String)
Dim conString As String = WebConfigurationManager.ConnectionStrings("Test").ConnectionString
Dim con As New SqlConnection(conString)
Dim cmd As New SqlCommand("INSERT Test (UserName,FirstName,LastName) VALUES (@.UserName,@.FirstName,@.LastName)",con)
cmd.Parameters.AddWithValue("@.UserName", userName)
cmd.Parameters.AddWithValue("@.FirstName", firstName)
cmd.Parameters.AddWithValue("@.LastName", lastName)
Using con
con.Open()
cmd.ExecuteNonQuery()
End Using
End Sub

</script>

<html>
<head>
<title>Untitled Document</title>
</head>

<body>
<form runat="server" id="form1">
<asp:CreateUserWizard id="CreateUserWizard1" OnCreatedUser="CreateUserWizard1_CreatedUser" Runat="server" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" requiresPassword="false">
<WizardSteps>
<asp:WizardStep>
<asp:Label id="lblFirstName" Text="First Name:" AssociatedControlID="txtFirstName" Runat="server" />
<br>
<asp:TextBox id="txtFirstName" Runat="Server" />
<br>
<br>
<asp:Label id="lblLastName" Text="Last Name:" AssociatedControlID="txtLastName" Runat="server" />
<br>
<asp:TextBox id="txtLastName" Runat="server" />
</asp:WizardStep>
<asp:CreateUserWizardStep />
</WizardSteps>
</asp:CreateUserWizard>

</form>
</body>
</html>

The exact error with stack trace is below:

Invalid object name 'dbo.aspnet_SchemaVersions'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: Invalid object name 'dbo.aspnet_SchemaVersions'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[SqlException (0x80131904): Invalid object name 'dbo.aspnet_SchemaVersions'.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857242 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734854 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +149 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +886 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +415 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135 System.Web.Util.SecUtility.CheckSchemaVersion(ProviderBase provider, SqlConnection connection, String[] features, String version, Int32& schemaVersionCheck) +367 System.Web.Security.SqlMembershipProvider.CheckSchemaVersion(SqlConnection connection) +85 System.Web.Security.SqlMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +3612 System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +305 System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +105 System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +453 System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +149 System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +17 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

Any help is much appreciated, and thanks in advance.

How do you create the aspnet_SchemaVersions Table? did you use the tool come with VS? if not you have to verify all the table names, column names are type correctly. sepcially make sure your table name is "aspnet_SchemaVersions" not "aspnet_SchemaVersion"

Hope this help

|||I figured out the problem, I had changed the ownership of the table and apparantly the createuserwizard control doesn't like you to do that, so that generic error was the result.|||

I am sure this is the case when you are working on local server, on your own machine.

What if you have deployed working application to the ftp server say (godaddy), which has old version of SQL, SQL Server 2000?

I am facing this issue, the application works fine on local machine, but when it comes to godaddy, I have an error:

Invalid object name 'dbo.aspnet_SchemaVersions'.

How to set schema for godaddy or just modify application on local machine so that when uploaded it works on host server. Any views are welcomed.

Cheers

sql