Skip to content

ErcanOPAK.com

  • ASP.Net WebForms
  • ASP.Net MVC
  • C#
  • SQL
  • MySQL
  • PHP
  • Devexpress
  • Reportviewer
  • About

Tag: database

ASP.Net MVC / ASP.Net WebForms / C# / SQL

How to add default value for Entity Framework migrations for DateTime and Bool

- 19.06.22 - ErcanOPAK comment on How to add default value for Entity Framework migrations for DateTime and Bool

Just add defaultValue parameter in CreateTable method for property: public partial class TestSimpleEntity : DbMigration { public override void Up() { CreateTable( “dbo.SimpleEntities”, c => new { id = c.Long(nullable: false, identity: true), name = c.String(), deleted = c.Boolean(nullable: false, defaultValue: true), }) .PrimaryKey(t => t.id); } public override void Down() { DropTable(“dbo.SimpleEntities”); } } After that, run update-database -verbose command, […]

Continue Reading ..
SQL

How to enable, disable and check if Service Broker is enabled on a database in SQL Server

- 14.01.22 - ErcanOPAK comment on How to enable, disable and check if Service Broker is enabled on a database in SQL Server

To enable Service Broker run: ALTER DATABASE [Database_name] SET ENABLE_BROKER; To disable Service Broker: ALTER DATABASE [Database_name] SET DISABLE_BROKER; To check if Service Broker is enabled on a SQL Server database: SELECT is_broker_enabled FROM sys.databases WHERE name = ‘Database_name’; If the result is ‘1’, the Service Broker is enabled. Thanks to zarez.net for this useful […]

Continue Reading ..
SQL

How To Get All Row Count For All Tables In SQL Server Database

- 04.08.21 - ErcanOPAK comment on How To Get All Row Count For All Tables In SQL Server Database

SELECT (SCHEMA_NAME(A.schema_id) + ‘.’ + A.Name) AS TableName , SUM(B.rows) AS RecordCount FROM sys.objects A INNER JOIN sys.partitions B ON A.object_id = B.object_id WHERE A.type = ‘U’ GROUP BY A.schema_id, A.Name ORDER BY RecordCount DESC  

Continue Reading ..
MySQL / PHP

How do you connect to multiple MySQL databases on a single webpage?

- 05.05.19 | 14.04.20 - ErcanOPAK comment on How do you connect to multiple MySQL databases on a single webpage?

You can make multiple calls to mysql_connect(), but if the parameters are the same you need to pass true for the ‘$new_link‘ (fourth) parameter, otherwise the same connection is reused.

Continue Reading ..
PHP

How to connect MySQL Database with PHP

- 22.04.19 | 22.11.19 - ErcanOPAK comment on How to connect MySQL Database with PHP

You can try code below:

Continue Reading ..
SQL

What does COALESCE do in SQL?

- 02.06.18 | 30.08.20 - ErcanOPAK comment on What does COALESCE do in SQL?

In SQL Server (Transact-SQL), the COALESCE function returns the first non-null expression in the list. If all expressions evaluate to null, then the COALESCE function will return null. SELECT COALESCE(NULL, NULL, ‘ErcanOPAK.com’, NULL, ‘blog.ErcanOPAK.com’); Result: ‘ErcanOPAK.com’ SELECT COALESCE(NULL, ‘ErcanOPAK.com’, ‘blog.ErcanOPAK.com’); Result: ‘ErcanOPAK.com’ SELECT COALESCE(NULL, NULL, 1, 2, 3, NULL, 4); Result: 1

Continue Reading ..
August 2022
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031  
« Jul    

Most Viewed Posts

  • Get the First and Last Word from a String or Sentence in SQL (362)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (234)
  • Find numbers with more than two decimal places in SQL (204)
  • Confirm before process with ASPxButton in Devexpress (200)
  • Add Constraint to SQL Table to ensure email contains @ (200)
  • ASPxGridView – Disable CheckBox based on condition in GridViewCommandColumn (199)
  • How to solve “Response.Redirect cannot be called in a Page callback” for DevExpress Components (197)
  • How to make some specific word(s) Bold or Underline in ReportViewer (191)
  • Devexpress ASPxGridview Column Grouping in Code (184)
  • Tense Changes When Using Reported Speech (171)

Recent Posts

  • How to create the ShowBlanksValue and ShowNonBlanksValue items in Devex Grid
  • How to get ‘n’th row in Sql Query with OFFSET FETCH NEXT and ROW_NUMBER()
  • How to change the style of scrollbar with CSS
  • How to add scroll bar to div in Asp.Net
  • How to solve “Fatal: Not possible to fast-forward, aborting” problem
  • How to add Output Parameter to SqlDataSource
  • How to get stored procedure parameters details in SQL
  • How to add default value for Entity Framework migrations for DateTime and Bool
  • String Interpolation, String Format, String Concat and String Builder in C#
  • How to get triggers create and update date in SQL

Recent Posts

  • How to create the ShowBlanksValue and ShowNonBlanksValue items in Devex Grid
  • How to get ‘n’th row in Sql Query with OFFSET FETCH NEXT and ROW_NUMBER()
  • How to change the style of scrollbar with CSS
  • How to add scroll bar to div in Asp.Net
  • How to solve “Fatal: Not possible to fast-forward, aborting” problem

Most Viewed Posts

  • Get the First and Last Word from a String or Sentence in SQL (362)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (234)
  • Find numbers with more than two decimal places in SQL (204)
  • Confirm before process with ASPxButton in Devexpress (200)
  • Add Constraint to SQL Table to ensure email contains @ (200)

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter

© 2022 ErcanOPAK.com

Proudly powered by WordPress | Theme: Xblog Plus by wpthemespace.com