Friday, December 7, 2007

Query full text table with RANKING

--Full text search query
select * from <FullTexed table name> O, CONTAINSTABLE(<FullTexed table name>, <FullTexed table column of your table>, '<search word>') AS K
WHERE K.[KEY] = O.<primary key of the table>
ORDER BY K.RANK DESC

Example:
select * from organisation O, CONTAINSTABLE(Organisation, Description, 'internet OR intranet') AS K
WHERE K.[KEY] = O.OrganisationID
ORDER BY K.RANK DESC

Get DataBase info from queries

Get all SP names in a database

Simply run the below query under your database.

--Get all SP list of a DB
select name from sysobjects where type='p' order by name asc

Gt all Table of a DB

SELECT [A].* FROM [sysobjects] AS A where [Xtype] = 'U' order by [A].[name]

Gt all column names of a table

SELECT [syscolumns].* FROM [syscolumns], [sysobjects], [systypes] where [syscolumns].[ID] = [sysobjects].[ID] and [syscolumns].[xtype]=[systypes].[xtype] and [syscolumns].[id] = '<Table ID got from above query>' order by colid

Monday, September 24, 2007

Wednesday, August 15, 2007

Mobile emulators in Visual Studio

This is how you can configure mobile device emulators in visual studio 2005.

1. install Microsoft "virtual pc" and "active sync"
2. open active sync and change dropdown to "DMA" and press ok
3. open device manager from .net IDE>> tools>> device emulator manager
4. right click the one you need to connect
5. select "connect". this will open the device interface
6. now right click the same item from the device manager
7. select "craddle". this will connnet your PC to the device.

now use the browser of the device to connect to your PC IIS. you need to use the MACHINE NAME as the sever name. (IP or LOCALHOST wont work) This can be used to develop and test windows and web applications for mobile devices.

Wednesday, August 1, 2007

Sql Server - BCP (Bulk copy program)

Bulk copy program is a very useful tool to be used when populating bulk data to the DB when load testing though it is not the intended usage of it. It created to set transfer bulk copies from server to any other in case of a batch transfer.

The simple command template is:
bcp <Db name>.dbo.<table name> in <file name> -c -t, -S<db server name> -U<user name> -P<password>

Exsample:
bcp MyDB.dbo.User out c:\users.txt -c -t, -S192.168.100.01 -Ume -Ptest

When you use "out", it will output table data to the specified file. By simply changing "out" to "in", you can easily input data from a text file you already have.

The above is for using sql server authentication to login to the server. If you need to use windows authentication, you need to add "-T" switch also. There are lot of other switches you can use with this command.

Monday, July 30, 2007

Show child object properties in GridView

Here we have a simple trick.

I'll introduce my objects first.



Nothing to worry about. If I show you the XML view of the User[], it should looks like below.



Now we can assign this to a GridView.
Code:

GridView1.DataSource = UserList;
GridView1.DataBind();

Design:
Dont forget to import the objects namespaces in the page header in the HTML view.

........
........


Explanation:

I'm using to show the child object property values in to the grid.


What we are doing here is to match the Parent object property name Home to access the child object. Actually it is a object of Address type. So that I can cast the object to Address type and access the child property Country.

Thursday, July 19, 2007

Assign object list to a GridView in asp.net 2.0

Simply follow the scenario below.

1. Drag a GridView control to the page.
2. Assign the Object list into the grid as below.
// c# - Bind data to the drop down
GridView1.DataSource = userList;
GridView1.DataBind();


3. Run the application. That's all.

If you need to show only few columns, do the following.
1. Go to GridView Properties.
2. Open the "columns" property.
3. Uncheck the check box "Auto-Generate fields".
4. Add any type of fields and set the "DataField" to a property in your object for the selected field. For example "UserName".

Out source developments

We have a set of teams accepting out sourced development projects (small to medium in complexity). They are always ready to provide you the best with a good design, robust application and a good support after the delivery.

Monday, July 9, 2007

Use multiple log4net outputs from one application

Who are interested in resolving this for your project, refer the following article i wrote to code project.

Log4net

Some of the beautiful clickes i made

The best is all are from Sri Lanka. ("A land like no other")















Thursday, July 5, 2007

Welcome!!!

Welcome to my blogspot. I'll be posting more soon.