"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Friday, November 25, 2011

Remove Duplicate record from Table

Hi *.*,

create table #tbdemo (
id int identity(1,1),
StrName Nvarchar(50),
StrCity Nvarchar(50)
)

insert into #tbdemo values ('Arun','Kollam')
insert into #tbdemo values('Arun','Kollam')
insert into #tbdemo values('Prajeesh','Kochi')
insert into #tbdemo values('Prajeesh','Kochi')
insert into #tbdemo values('Sibi','Patnapuram')
insert into #tbdemo values('Sibi','Patnapuram')
insert into #tbdemo values('Dasapan','Kozikodi')
insert into #tbdemo values('Dasapan','Kozikodi')

select * from #tbdemo

select MIN(id) as ID from #tbdemo
GROUP BY StrName,StrCity

DELETE FROM #tbdemo
WHERE id NOT IN(select MIN(id) as ID from #tbdemo GROUP BY StrName,StrCity)


If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Thursday, November 24, 2011

Assign Value to a variable on Store Procedure

Hi *.*,
Assign Value to a variable on Store Procedure. First declare a variable with prefix '@'.Then you can use both 
SET and SELECT.

Sunday, November 20, 2011

Exporting an sql table to XML

Hi *.*,
To export data first it should be hold in a Dataset or Datatable or else where we can loop(Here i used a dataset).

Saturday, November 19, 2011

Unknown server tag 'asp:xxx'.

Hi *.*,
Its another common error seen after adding Ajax or by adding new web-config file to project.
Its happen when asp can't understand server tag !!!
Solution:
  • Remove Ajax dll from bin folder add Ajax once more ('m not recommending this)
  • Add tagprefix on webconfig.

Wednesday, November 16, 2011

ERROR: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

Hi *.*,
Yet another common error while handling with datetime in sql.Worst part of this error is on code side and sql site we had given datetime as datatype.Still its their !!!!

Saturday, November 12, 2011

Hyperlink with more than one parameter Or Error: Server tag not well Formed with Hyperlink

Hi *.*,
In my first day of .net i found this error the with the help of my senior i resolved it.Then i didn't know why it come so.2day my junior faced same issue i gone through and got why it come :).its all because when binding hyperlink with data not at just data, you have to give entire NavigateUrl the Server control. and also (single quote) and (Double quote) have to be in correct way too...

Tuesday, November 8, 2011

Sunday, November 6, 2011

javascript validation on Default Button event and passing control to server side

Hi *.*,
Heading of my post feel bit difficult to understand isit? :( .Actually i was confused to decide what should be the header of this post.Any way lets move to topic.
My friend again got trouble using default button.Now problem is he using Client-side validation then how can he perform it!!!.First i was also confused. Later i got it :).On my previous post i show how to get keyboard unicode.that helped me here.
onkeypress event of text box i'm checking whether it ENTER key hit or not !!! Now if so i will do my condition if it pass that i will pass event to server side.

Saturday, November 5, 2011

One page with multi Default Button

Hi *.*,
As part of my last post.My friend ask me whether its possible to have multi Default Button in one page. Yes it possible.

Friday, November 4, 2011

Default button and Default Focus

HI *.*,
Default button property is used to specify which button gets clicked when "ENTER" key is pressed.
and Default Focus  property is used to get focus on that control on page start-up(Just like Gmail login,Focus on Username text box and when enter button is clicked login,if valid :P )

Thursday, November 3, 2011

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Hi *.*,
This is one of the most frequently asking question on sql/asp fourms.
Reasons for this error:

  1. Make sure your connection string data are correct and only that particular string is you calling.
  2. You need to enable the listener on port 1433 in the SQL Server Configuration Manager control panel
  3. Enable the "sa" user. It's disabled by default after the install.
  4. Set a password on the "sa" user.
  5. Enable SQL Authentication + NT Authentication mode.
  6. Make sure the Windows firewall isn't blocking port 1433.
  7. Try the default instance name instead of SQLEXPRESS.
  8. Make sure the remote connection is using TCP/1433



If u had any trouble just ask, Happy to help u :) 
Stay Tune... 
Have a nice day... 'N happy Coding :)

Wednesday, November 2, 2011

Difference between GETDATE() and GETUTCDATE()

Hi *.*,
Playing with date-time is one of the biggest headache to me. :( . i faced a problem recently with that. Server is located at one place and client at another place  so what happened is the date doesn't change for 4.15 hrs!!!!.
Later v solved by adding GMT along with that.
Here i'm sharing the SQL script helped to get out of that.