This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to use SQL user defined functions in .NET?
Say I have created a SQL Server function function1(int a,int b) in my database, now how can I call this function in MVC3 controller ?
You would use either ADO.NET or any one of many other database technologies.
Related
This question already has answers here:
What does a timestamp in T-Sql mean in C#?
(4 answers)
Closed 4 years ago.
My client is using Insight.Database for SQL Server ORM, using C# as the client. I have encountered a SQL Server 2017 database datatype 'Timestamp' and I am unsure what the C# entity type should be? I have downloaded the code for the Insight.Database and have globally searched for Timestamp, but results are empty.
Any ideas what datatype in C# would best represent a SQL Server Timestamp datatype?
It would be a byte array as that's what you'd use for varbinary.
https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-data-type-mappings
This question already has answers here:
How can I determine if a SQL Server stored procedure parameter has a default?
(7 answers)
Closed 7 years ago.
I am using C# to connect to Sql Server. I am trying to get Parameter Details of stored procedure before calling the stored procedure. Can you please help me regarding how I can get to know whether any SP parameter is optional or not form C# code itself.
I am using loaclDb in VS 2013. I have Data Source and Db File Name available.
TIA.
You may do like this way:
Server servev = new Server("YourServerName");
Database dataBase = servev .Databases["YourDatabase"];
var paramData = dataBase.StoredProcedures["YourProcedureName"].Parameters;
foreach(StoredProcedureParameter param in param) {
string paramName=param.Name;
string paramValue=param.DefaultValue;
}
This question already has answers here:
How to get Url Hash (#) from server side
(6 answers)
Closed 9 years ago.
How to get the value after # in the following url:
www.google.com/trian/test#dummyvalue
I am using ASP.NET and C#
A web browser won't pass this value back to the server. So in a typical scenario with a user on their computer accessing your website. The "fragment" portion of the url won't be supplied to the server. Therefore, your asp.net code can not access it. If you change your code to put this data in the querystring, then you can access it server side from asp.net.
This question already has answers here:
Determine SQL Server Database Size
(8 answers)
Closed 9 years ago.
How can one check the SQL Server database and table size (in MB) using C#?
Have you looked at the sp_spaceused stored procedure?
Just execute it with DBName.Tablename.
Here is the MSDN Link
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Solutions for INSERT OR UPDATE on SQL Server
Check if a row exists, otherwise insert
I'm using SQL Server 2008 R2, C# .NET 4.0 (and LINQ).
I want to get or create a row in a table and then append a string to one of its columns.
I'm wondering if there's a best practice for this kind of idiom, or if SQL offers this out of the box?
Somehow transaction start -> select -> insert or update -> transaction end doesn't seem elegant enough...