Using Common Class To Find Number Of Row Using Stored Procedure
Feb 9, 2010we are develop a web application , i wants to write common function to get number of rows
in a table using sql strored procedure.
we are develop a web application , i wants to write common function to get number of rows
in a table using sql strored procedure.
Initially, I have tried to use stored procedure. But I changed my mind and preferred to call sql query in codebase with command text. However, it stills tries to find initially-called stored procedure (which is neither called or exists).I think that it is related caching. But I tried it with different browsers it did not work.What might be the reason?
View 4 RepliesI would like to create a common stored procedure for all insert operations performed in my Database. So i created a stored procedure as below.
[Code]....
But now my problem is how to pass parameters for this stored procedure. I have got the column names of the table passed. But i would like to pass the parameters for each insert operation of each table to identify which value is passed for which parameter.
how to pass parameters for this stored procedure.
(Parameter can be Column name prefixed @ i.e. @Column name)
It is possible to get the column names in another Stored Procedure . But how to prefix @ for each column and pass this as parameter to the Common Insert Stored Procedure?
I have migrated a database from one server to another and following the migration had an orphaned user (WholeSystem_webuser), which has been fixed using the auto_fix option of sp_change_users_login
•The WholeSystem_webuser account is used by ASP.NET pages to connect to the database and run stored procedures.
•I can log in to Management Studio as WholeSystem_webuser OK and execute the sp's from there
•When I try to run my ASP.NET page it was saying “Can’t find stored procedure [procedure name]”
•If I drop the sp and create it as [dbo].[GetContactsCount] instead of [WholeSystem_ webuser]. [GetContactsCount] it says “The EXECUTE permission was denied on the object 'GetContactsCount', database 'WholeSystem', schema 'dbo'.” (which is what I’d expect as the connection string is using the WholeSystem_webuser account??) –does that show that the web user is logging into the database OK??
•If I try and configure the SqlDataSource in VWD to see what it is looking at though, it won’t let me get beyond the connection string window and says “Default schema could not be retrieved for this connection”
•I tried setting up a new login/user/connection string but still get the
“Default schema could not be retrieved for this connection” error
IN SQL Server:
•Users mapped to the login WholeSystem_webuser - WholeSystem_webuser, default schema dbo
•User WholeSystem_webuser has default schema dbo and db_dataread and db_datawrite permissions
•There is a schema dbo whose owner is dbo, and a schema WholeSystem_webuser whose owner is WholeSystem_webuser
I have stored procedure in my database but its give error "Could not find stored procedure"Is this error occuring when maked error in permision,sp code or connection code
View 3 RepliesI have many stored procedure in database sql server , so ow can i count the number of stored procedure which tel me the result
like for example i made 39 sps but i dnt know
Is there any way to count the number of stored procedures in specific database?
I created a database on SQL Server 2005 developer edition with MS SQL Server Mangement Studio Express. Now I created code that accessess a stored procedure named 'pS_TableData'. However I have one problem the code raises an exception "Could not find stored procedure 'pS_TableData 'Letters''."the code looks like this:
[Code]....
Note I am using (for now) the same connection that I used to create my database so in essence my web site is the administrator. I tried a simple SELECT from a table with the same connection and it raised no exceptions!When I run EXECUTE ps_TableData 'Letters' in SSMS it has no . I also tried EXECUTE ps_TableData 'Letters' as the command paramated for SqlCommand but it had the same effect
I have this stored procedure which check a collection and according to that return a result.
The problem is I want to check if a number is between 10-20 then do something
How on earth you checking something like that? I know > and < etc.. but checking if a value is a number between 10-20?
There is one sp(1) which is called from another sp(2)How can I find from which sp it is called.
View 2 Repliesfind the names of tables refered in a perticular stored procedure
View 10 RepliesI have just uploaded my website to 1and1. I have a regsiter control using createuserwizard. But when i go to register it brings the error Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'. I am using my own sql database to store the data and not what is provided by default.
View 10 RepliesI have ported over the website to my localhost running windows 7, I got the Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'. before so I ran the aspnet_regsql.exe and fixed it after the error I fixed I was able to login into the CMS however when I try to save content it gives me :-
Could not find stored procedure 'dbo.sp_UpdateContentById'. 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: Could not find stored procedure 'dbo.sp_UpdateContentById'. Source Error:
[Code]....
Line 73: public int sp_UpdateContentById([Parameter(Name="ContentId", DbType="Int")] System.Nullable<int> contentId, [Parameter(Name="Content", DbType="VarChar(MAX)")] string content)Line 74: {Line 75: IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), contentId, content);Line 76: return ((int)(result.ReturnValue));Line 77: }
Source File: c:IQTECHPROApp_CodeCkEditor.designer.cs Line: 75
we recently upgraded an application (.NET 2.0) that we maintain to use Oracle 11g. The application uses MS Enterprise Library 2.0. We've found that when the database.ExecuteNonQuery(Oracle.DataAccess.Client.OracleCommand) method is called, it bombs when the stored procedure expects a parameter as a number, but receives a string. This didn't happen prior to upgrading. If I cast the parameter to an Int, I don't recieve the error. Was something possible missed during the upgrade? The issue occurs regardless if we are hitting an 11g database, or a 10g database.
EDIT: I neglected to mention that this same issue does not occur when ExecuteDataReader is called (handles implicit conversion of the datatype).
I am getting frustrated with this problem, I dont know what i did, but now I cannot execute any stored procedured when I could last time.When I use my asp.net application to run the query, it finds the stored procedure but when I execute it is sql management studio it says it cannot find the stored procedure even though it is there.I tried to execute other procedures and the samething happens. Even when I try a simple query it says it cannot find the tableI could execute the query if i placed Use [databasename] in front, but even with this, I cannot execute stored procedures.
View 12 RepliesI'm using forms authentication and gettnig the following error: Server Error in '/' Application. Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'. 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: Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.
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): Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2030802
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009584
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +215
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +178
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
System.Web.Util.SecUtility.CheckSchemaVersion(ProviderBase provider, SqlConnection connection, String[] features, String version, Int32& schemaVersionCheck) +392
System.Web.Security.SqlMembershipProvider.CheckSchemaVersion(SqlConnection connection) +84
System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +827
System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105
System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +106
System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +60
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +129
System.Web.UI.WebControls.Login.AttemptLogin() +127
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +101
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +125
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +167
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
here's my code on my web.config file:
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="OleConnectionStringSource" connectionString="Data Source=alg-sql01;Initial Catalog=PriceFinder;User ID=PriceFinderUser;Password=******;Integrated Security=false"
providerName="System.Data.SqlClient" />
<add name="OleConnectionStringTarget" connectionString="Data Source=alg-sql01;Initial Catalog=PriceFinder;User ID=PriceFinderUser;Password=******;Integrated Security=false"
providerName="System.Data.OleDb;" />
<add name="PriceFinderConnectionString" connectionString="Data Source=alg-sql01;Initial Catalog=PriceFinder;Integrated Security=True"
providerName="System.Data.SqlClient" />
<add name="PriceFinderConnectionString2" connectionString="Data Source=alg-sql01;Initial Catalog=PriceFinder;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms loginUrl="~/default.aspx" timeout="2880" />
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="OleConnectionStringSource"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
I kept getting this using ASP.NET Administration Tool/Security tab: There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store. Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.
View 3 RepliesIam using Visual Studio 2010 ultimate. Iam trying to use a CreateUserWizard control, but iam getting this error below,eachtime i click the click user. Kindly guide me where iam getting wrong.this has disturbed me for two dayz,figuring out where the problem is but i cannot see it. Kindly see Both my web.config file below and the type of error iam getting.
<?
xml
version="1.0"?>
<!--
For more information on how to configure your ASP.NET application [URL]
-->
<
<
<
configuration>connectionStrings>add
name="WebDataBaseConnectionString"
connectionString="data
source=.SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|WebDataBase.mdf;User Instance=true"
</
providerName="System.Data.SqlClient"
/>connectionStrings>
<
<
system.web>compilation
debug="false"
targetFramework="4.0"
/>
<
<
</
authentication
mode="Forms">forms
loginUrl="~/Account/Login.aspx"
timeout="2880"
/>authentication>
<
<
<
<
membership
defaultProvider="WebDataBaseSqlMembershipProvider">providers>clear/>add
name="WebDataBaseSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="WebDataBaseConnectionString"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
</
</
applicationName="/"
/>providers>membership>
<
<
<
<
</
</
profile>providers>clear/>add
name="WebDataBaseSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="WebDataBaseConnectionString"
applicationName="/"/>providers>profile>
<
<
<
<
<
</
</
roleManager
enabled="false">providers>clear/>add
name="WebDataBaseSqlRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="WebDataBaseConnectionString"
applicationName="/"
/>add
name="AspNetWindowsTokenRoleProvider"
type="System.Web.Security.WindowsTokenRoleProvider"
applicationName="/"
/>providers>roleManager>
</
system.web>
<
<
</
</
system.webServer>modules
runAllManagedModulesForAllRequests="true"/>system.webServer>configuration>
This is the type of error iam getting below Server Error in '/AspDotNetWebsite' Application. Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'. 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: Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'. Source Error:
[Code]....
Stack Trace:
[Code]....
After attaching debugger when i run my application it's give me error "Could not find stored procedure 'sp_sdidebug'".I am using 1.14 framework in backend sql server 2005
View 3 RepliesThis is surareddy. i nead some small clarification in the "Stored Procedure"
how to convert the oracle Stored Procedure to sqlserver2005/2008 Stored Procedure.
right now i am enhancing the project that project already developed the oracle Stored Procedure. now our company is using sqlserver 2005/2008.
how to convert the Oracle Stored Procedure to sqlserver 2005 Stored Procedure
I could probably figure this out if I tried to, but I have been working so long on code, I'm a little fried
I have a stored procedure, and I want to execute another stored procedure during a time period of lets say 1/1/2011 to 12/31/2011
How Would I accomplish this?
Does anybody if it is possible that a stored procedure returns rows which is the result of the execution of another sp? Something like..
[Code]....
i want to return output parameter from 1 storeprocedure. into another stored procedure.
View 7 RepliesServer Error in '/staff' Application. Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'. 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: Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'. Source Error:
[Code]....
Stack Trace:
[Code]....
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
how can I create stored procedure and write my select statement in it, I know how to create dataset then put type stored procedure and assign it to the sp ... what I want is writing my sp... how can I make it ?
check the following code, this is what I want to write put I don't know where or how !
CREATE STORED PROCEDURE SP_CATEGORY
@CATEGORY VARCHAR(30)
AS
BEGIN
SELECT LATIN_NAME, ENGLISH_NAME, ARABIC_NAME, CATEGORY
FROM FLORA, CATEGORY_LIST
WHERE FLORA.CATEGORY=CATEGORY_LIST.CATEGORY_NAME AND CATEGORY_LIST.CATEGORY_NAME IN (SELECT * FROM SPLITLIST(@CATEGORY, ','))
END
where can I write this code ?!
Which method would you like to place in tyour common class in asp.net application? A common function which you use in almost all your asp.net project question.
View 5 Replies