[Solved] List of stored procedures inside a database

The following query will list all user defined stored procs (including their parameters and parameter types) in your default database: SELECT sp.name, p.name AS Parameter, t.name AS [Type] FROM sys.procedures sp LEFT JOIN sys.parameters p ON sp.object_id = p.object_id LEFT JOIN sys.types t ON p.system_type_id = t.system_type_id WHERE is_ms_shipped = 0 ORDER BY sp.name Put … Read more

[Solved] Failed to convert parameter value from a SqlParameter to a String

The ExecuteDataSet call takes the actual parameter values, not SqlParameter objects. Change it to simply do: var ds1 = db.ExecuteDataSet(“Getmagesbylot2”, “Bob123457”); You might also want to check that you’ve spelled the SP correctly, maybe it should be GetImagesByLot2. 2 solved Failed to convert parameter value from a SqlParameter to a String

[Solved] Stored procedure has too many arguments in SQL Server and C# but on second entry

I think you didn’t clear the parameters. You should clear it always after your transaction. cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue(“@UserId”, userId); cmd.Parameters.AddWithValue(“@MonthlyIncomeName”, income.MonthIncomeName); cmd.Parameters.AddWithValue(“@MonthlyIncomeAmount”, income.MonthIncomeAmount); cmd.Parameters.AddWithValue(“@TotalMonthlyIncome”, income.MonthIncomeAmount); cmd.Parameters.AddWithValue(“@Month”, insertMonth); cmd.Parameters.AddWithValue(“@Year”, insertYear); cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); // insert this line And search about AddWithValue vs Add like @cha said that check your parameter types. See this. 1 solved Stored … Read more

[Solved] How to add values from a string in SQL Server 2008 using a stored procedure? [closed]

I have prepared a SQL script for you which splits the input string twice then converts is into row data, and finally inserts into a database table To split string data, I used this SQL split string function First of all, you need to create this function on your database. Unfortunately, if you do not … Read more

[Solved] stored procedures instead of forms

You’re describing Web Forms, which is another part of ASP.NET, but not part of ASP.NET MVC. The calling of stored procedures has nothing to do with any of these technologies. Some people choose to put such calls in their Controller or Code-Behind rather than having it in a separate data layer. 2 solved stored procedures … Read more

[Solved] I have a query with a between clause that is return wrong days [closed]

Let’s break this down: WHERE convert(varchar(10),F_Presence.ts, 120) between ‘2022-03-01’ and ‘2022-03-02’ Converting the column to a string means you will never, ever, ever be able to take advantage of an index on that column, whether it exists yet or not. Using BETWEEN is horrible for date ranges for multiple reasons. Using a format like YYYY-MM-DD … Read more

[Solved] CONCAT in stored procedure returns null

The documentation says CONCAT() returns NULL if any argument is NULL. This is demonstrated by this example: http://sqlfiddle.com/#!2/d41d8/47037 You can find some documentation on working with nulls here: http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html 2 solved CONCAT in stored procedure returns null

[Solved] C# DateTime not working for MSSQL stored procedure [closed]

Lets work backwards here – your stored proc will never work, you have not specified a field for the where, and it has 2 missing close parentheses. select * from MyTable where between CAST(@startDate AS VARCHAR(100) and CAST(@EndDateAS VARCHAR(100) should be select * from MyTable where SOMEFIELD between CAST(@startDate AS VARCHAR(100)) and CAST(@EndDateAS VARCHAR(100)) In … Read more