How can I add search condition to SQL Stored Procedure programmatically? In my application(C#) I’m using stored procedure (SQL Server 2008R2) ALTER PROCEDURE [dbo].[PROC001] @userID varchar(20), @…
Tag: c#
Unexpected database output when using INNER JOIN
I have the following SQL query SELECT r.BEZEICHNUNG AS BEZEICHNUNG, r.ID AS ID, ra.BEZEICHNUNG AS raumBEZEICHNUNG, ra.ID AS raumID FROM RAUM r INNER JOIN RAZUORDNUNG rz …
how can i set the parameters for the sql query optional?
I build a Web Service in ASP.Net which sends me a list of rooms. The parameters are id’s which are separated by a comma. I saved them to a string and build a sql select query. When I send all 4 parameters I everything works fine and I get a result. But when I send less then 4 I get
Change default date format of the asp sql database ( the one storing the values)
I have a gridview and SqlDatasource. I have a column called Date VMS which is type Date. I’ve noticed that the format for adding a date won’t allow adding a date like: 30/02/2012. ( DD/MM/YYYY) I have an Excel sheet from which I’m copying the rows and I’m adding them in the table. The format of the date in the
How to get Database Name from Connection String using SqlConnectionStringBuilder
I do not want to split connection strings using string manipulation functions to get Server, Database, Username, and Password. I read the following link and read the accepted answer, I found that is the best way to get username and password out from connection string, but what about Database Name? Right way to get username and password from connection string?
Stored Procedures vs Code in Database Query
What are the performance differences between accessing a database to query using ASP.NET Code behind against using SQL Stored Procedure For ease of use, coding the query is easier, especially when …
Can I change the default schema name in entity framework 4.3 code-first?
Currently I am deploying my application to a shared hosting environment and code-first with migrations has been working great except for one minor hiccup. Everytime I want to push the site I have to use the “Update-Database -script” option because I have to prepend every table name with [dbo] because by default the shared host creates a default schema name
What is better to return single value from stored procedure to .Net: OUTPUT parameter or ExecuteScalar?
I need to create a stored procedure that needs to return a count of some records. I’m using .Net to read the result. I can use an OUTPUT parameter to return the value or I could do a select count(*) …
Accessing database connection string using app.config in C# winform
I can’t seem to be able to access the app.config database connection string in my c# winforms app. app.config code C# code: When I try the C# code, I get a message: Warning 1 ‘System.Configuration.ConfigurationSettings.AppSettings’ is obsolete: ‘ This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings’ However, when I try to use: I get an error: Only assignment,
Function as parameter to another function in Postgres
Can I create a user defined function in Postgres either through the C-Language Function API or by using pl/pgsql which accepts a callback function as parameter? As far as I see there is no way to do this through the C-Language API since it only accepts sql datatypes and there is no datatype for function. But maybe I’m missing something?