Wednesday, 23 November 2011

clear combobox Items

dim strEmpty as string={}

combobox.datasource=strEmpty

combobox.databind()

Tuesday, 22 November 2011

Case sensitive search in SQL Server queries

Password Case Sensitive Search

Use COLLATE clause in your T-SQL statement.

SELECT * FROM dbo.TableName WHERE username=@username 
and Password = @ password COLLATE SQL_Latin1_General_CP1_CS_AS

Tuesday, 15 November 2011

Cannot use a leading .. to exit above the top directory

What this means is that your web page is referring to content which is in the folder one level up from your page, but your page is already in the website's root folder, so the relative path is invalid. Judging by your exception message it looks like an image control is causing the problem.
You must have something like:-
<asp:Image ImageUrl="..\foo.jpg" />
But since the page itself is in the root folder of the website, it cannot refer to content one level up, which is what the leading ..\ is doing.

Saturday, 8 October 2011

How to find a text inside SQL Server procedures / triggers?


1) Search in All Objects
This script search stored procedures, views, functions as well other objects.
-- Search in All Objects
SELECT OBJECT_NAME(OBJECT_ID),
definition
FROM sys.sql_modules
WHERE definition LIKE '% iID %'
GO
2) Search in Stored Procedure
This script search only stored procedure for specified column.
-- Search in Stored Procedure Only
SELECT DISTINCT OBJECT_NAME(OBJECT_ID),
object_definition(OBJECT_ID)
FROM sys.Procedures
WHERE object_definition(OBJECT_ID) LIKE '% iID %'
GO

Monday, 3 October 2011

Assign Value to Asp.Net TextBox with mode=”Password”

 Using ASP.NET, the default textbox in password mode (TextMode="Password") has the following restrictions:

  • The password can not be set (e.g., tbPassword.Text = "ThePassword";)
  • The password is not restored after a postback
Both restrictions make perfect sense for security reasons. Nonetheless, sometimes the above behaviour is not wanted (especially during development).
The new PasswordTextBox control is an extension of the standard ASP.NET TextBox and makes a password textbox behave like a regular textbox.

PasswordTextbox.Attributes.Add("value", "ThePassword");

Use this to set the value, instead of setting the Text Property.

Saturday, 1 October 2011

Find a table knowing a column name

  Exactly know the column name,
  • SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'YOURCOLUMN

  if you're unsure exactly what the column is named,but you suspect you know part of the
  name, then try...
  • SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME  like  '%YOURCOLUMN%'