Skip to main content

Posts

Showing posts from July, 2015

Connecting to a another SQL Server instance on the same network/LAN

If you need to connect to another SQL Server instance on the same network you need to ensure the following settings are in place- 1. Your login should be added to the SQL Server instance you are trying to connect to. 2. The SQL Server instance should have Allow Remote Connections as checked.      a. Goto Instance Properties      b. Connections      c. Check "Allow remote connections to this server". 3. SQL Server Browser Service should be running in the machine you are trying to access. 4. TCP/IP Protocol should be enabled for the SQL Server     Steps         a.  Run SQL Server Configuration Manager         b. Go to SQL Server Network Configuration > Protocols for SQLEXPRESS         c. Make sure TCP/IP is enabled. Hope this helps!! Hitesh

Some random things learnt in customizing AX

Get your basics right 1. Do not make mistakes in extended data types, correcting them later will be taxing. Get them right early on in development 2. The aim to be good in customizing AX is to be able to achieve the customization with the least amount of code possible.  This requires you to look for code that you can reuse in the app. Also it means that you know what can be achieved through AOT nodes, properties instead of writing code. This requires some experience for sure 3. In AX to consider where do you write your code is as important as what you write in your code. The same type of result can be achieved by writing code either at the form level or at the table level or other places but it is important to know where to write the code to ensure least performance hit. This also means you need to know how your code will execute i.e in the client tier or the server tier and maybe both. 4. AutoDeclaration If you do not set AutoDeclaration property for a AOT object to "Y

SqlDependency Infinite Loop

I recently needed my C# application to invoke some code if there are changes done in a SQL Table. I researched and came across this article  This article shows how you can use a SQLDependency class to achieve the same. However I had one issue that my application was running into an infinite loop in the methods that invoked the SQLDependency. To resolve the same i had to simply prefix my table in the schema name and remove TOP clause from my sql query. Do read https://msdn.microsoft.com/en-us/library/ms181122.aspx  if your application is executing your code in an infinite loop. I would suggest placing a breakpoint on the code where you register dependency since you may not be able to know that the code is actually executing in a loop otherwise. Regards Hitesh

SQL Queries that i find very handy

The following query determines missing product ids from a sequence of product ids select l . Productid + 1 as start from product as l   left outer join product as r on l . Productid + 1 = r . Productid where r . Productid is null; The following query gives the recently modified stored procedures select name,create_date,modify_date from sys.procedures order by modify_date desc The following query gives me the C# class entity representation of a database table DECLARE @TableName VARCHAR(MAX) = 'NewsItem' -- Replace 'NewsItem' with your table name DECLARE @TableSchema VARCHAR(MAX) = 'dbo' -- Replace 'Markets' with your schema name DECLARE @result varchar(max) = '' SET @result = @result + 'using System;' + CHAR(13) + CHAR(13) IF (@TableSchema IS NOT NULL) BEGIN     SET @result = @result + 'namespace ' + @TableSchema  + CHAR(13) + '{' + CHAR(13) E