Pages

Sunday, 23 December 2012

Fun with GO Command of SQL.

In previous post, I explained using of “GO” command.
In this post i am going to explain how to rename “GO” command and use another word that you want as a batch separator.

STEPS:
Tools à Options…à Query Execution à SQL Server à General.

Suppose if i rename 'GO' to 'MYGO' then it can be use in following way:

         



















Saturday, 22 December 2012

GO Command in SQL

GO is not a T-SQL statement. GO is a command used for signalling the end of a SQL batch. Batch is nothing but a group of one or more Transact-SQL statements at the same time from an application to SQL server for execution.
GO is a utility command that requires no permissions. It can be executed by any user.
Please refer below image for more idea:


Difference between DataView.Table and DataView.ToTable

Both DataView.Table and DataView.ToTable return a DataTable from a DataView.
DataView.Table: It gives you the underlying data, with no changes from the dataview's sorting or filtering.
DataView.ToTable: It gives you the data in the dataview after filtering and sorting.

Please refer following image for more details:


Saturday, 8 December 2012

The Spatial Result tab in SQL Server.

Many days ago, i found very interesting feature of SQL server 2008 and above which is Spatial Result Tab so today i am going to show that feature.

SQL Server Management Studio 2008 and above introduces a new feature, the Spatial Results tab, which allows you to visualise the results of ad-hoc spatial queries directly in SQL Server Management Studio. To see the new Spatial Results tab, you simply need to execute and SELECT query that selects at least one column of geometry or geography data.

After you execute SQL query, you will be able to see something which is shown below image:


Download Query



Sunday, 25 November 2012

How to create your own code snippet in VS?

Code snippet is simply XML file which contains the code that we need to use most frequently while coding. I also like this feature very much because it save our developing time and increase productivity. You can create your own code snippet very easily. You can also add references and replacement parameters to your code.

For that first you need to install Snippet Designer Extension Tool in visual studio. You can also prepare snippet file(*.snippet) manually and add/import it using: Tool -> Code Snippets Manager (Ctrl + K, Ctrl + B). In this post i would like show you how to create and use snippet using Snippet Designer tool.

Steps to install Snippet Designer:
Goto Tools à Extension Manager.. à It opens Extension Manager window, Now you can install “Snippet Designer” from Online Gallery tab.


How to Create Snippet:
  • Just write your most usable code that you want to insert in snippet, just right click on code block and click Export as Snippet.



















  • Now you can set Snippet Name, Language and replacement setting.










How to Use Snippet:
  • Just press Ctrl + K, Ctrl + X in code behind file, it will open intellisense of all available snippet, so just go through snippet that you want. 





Saturday, 24 November 2012

BringToFront() and SendToBack() in windows form.

When you work with multiple layer design means when controls goes to overwrite with each other in windows form then Bring to front and Send to back comes handy. You can use these in both design and code behind.

In Design:
Just right click on control that you want to move front or back.


















In Code Behind:
panelWait.BringToFront()
panelWait.SendToBack()

Sunday, 18 November 2012

Solved : Cannot add a DataRelation or Constraint that has different Locale or CaseSensitive settings between its parent and child tables.

Many days ago, I was implementing parent-child relation in windows DataGridView using adding relation in DataSet among two DataColumns of two different DataTables and I faced below error.

Error Message :
Cannot add a DataRelation or Constraint that has different Locale or CaseSensitive settings between its parent and child tables.














Solution:
I found alternate solution from internet but below solution works for me fine. Its due to two datatable Locale property has different value. If you are going to add relationship then Locale of two datatable must be same. 

Mistake:
1) tblCustomer DataTable Properties:


2) tblOrder DataTable Properties: