c# Programming Glossary: sqlparameter
Soft Delete Entity Framework Code First http://stackoverflow.com/questions/12698793/soft-delete-entity-framework-code-first UPDATE 0 SET IsDeleted 1 WHERE ID @id tableName new SqlParameter id e.ID Marking it Unchanged prevents the hard delete entry.State..
WHERE IN (array of IDs) http://stackoverflow.com/questions/182060/where-in-array-of-ids buildingID IN @buildingIDs AND startDateTime @fromDate SqlParameter buildID new SqlParameter @buildingIDs buildingIDs c# sql server.. AND startDateTime @fromDate SqlParameter buildID new SqlParameter @buildingIDs buildingIDs c# sql server tsql ado.net sqlparameter..
Get output parameter value in ADO.NET http://stackoverflow.com/questions/290652/get-output-parameter-value-in-ado-net shows this but essentially you just need to create a SqlParameter set the Direction to Output and add it to the SqlCommand 's.. with Direction as Output and correct name and type SqlParameter outputIdParam new SqlParameter @ID SqlDbType.Int Direction ParameterDirection.Output.. and correct name and type SqlParameter outputIdParam new SqlParameter @ID SqlDbType.Int Direction ParameterDirection.Output cmd.CommandType..
How to use DbContext.Database.SqlQuery<TElement>(sql, params) with stored procedure? EF Code First CTP5 http://stackoverflow.com/questions/4873607/how-to-use-dbcontext-database-sqlquerytelementsql-params-with-stored-proced mySpName param1 param2 param3 At first I tried using SqlParameter objects as the params but this didnt work and threw an SqlException.. ctp5 share improve this question You should supply the SqlParameter instances in the following way context.Database.SqlQuery myEntityType.. myEntityType mySpName @param1 @param2 @param3 new SqlParameter param1 param1 new SqlParameter param2 param2 new SqlParameter..
C# calling SQL Server stored procedure with return value http://stackoverflow.com/questions/6210027/c-sharp-calling-sql-server-stored-procedure-with-return-value conn cmd.CommandType CommandType.StoredProcedure SqlParameter param new SqlParameter param cmd.Parameters.Add @SeqName SqlDbType.NVarChar.. CommandType.StoredProcedure SqlParameter param new SqlParameter param cmd.Parameters.Add @SeqName SqlDbType.NVarChar param.Direction..
Getting return value from stored procedure in C# http://stackoverflow.com/questions/706361/getting-return-value-from-stored-procedure-in-c-sharp sqlcomm.CommandType CommandType.StoredProcedure SqlParameter param new SqlParameter @a SqlDbType.VarChar param.Direction.. CommandType.StoredProcedure SqlParameter param new SqlParameter @a SqlDbType.VarChar param.Direction ParameterDirection.Input.. param.Value Username sqlcomm.Parameters.Add param SqlParameter retval sqlcomm.Parameters.Add @b SqlDbType.VarChar retval.Direction..
Unable to cast object of type 'System.DBNull' to type 'System.String` http://stackoverflow.com/questions/870697/unable-to-cast-object-of-type-system-dbnull-to-type-system-string CommandType.StoredProcedure GetCustomerNumber new SqlParameter @id id return accountNumber.ToString I replaced with public.. CommandType.StoredProcedure spx_GetCustomerNumber new SqlParameter @id id if accountNumber is System.DBNull return string.Empty..
|