반응형

Column names

If a column name contains any of these special characters ~ ( ) # \ / = > < + - * % & | ^ ' " [ ], you must enclose the column name within square brackets [ ]. If a column name contains right bracket ] or backslash \, escape it with backslash (\] or \\).

[C#]

dataView.RowFilter = "id = 10";      // no special character in column name "id"
dataView.RowFilter = "$id = 10";     // no special character in column name "$id"
dataView.RowFilter = "[#id] = 10";   // special character "#" in column name "#id"
dataView.RowFilter = "[[id\]] = 10"; // special characters in column name "[id]"

Literals

String values are enclosed within single quotes ' '. If the string contains single quote ', the quote must be doubled.

[C#]

dataView.RowFilter = "Name = 'John'"        // string value
dataView.RowFilter = "Name = 'John ''A'''"  // string with single quotes "John 'A'"

dataView.RowFilter = String.Format("Name = '{0}'", "John 'A'".Replace("'", "''"));

Number values are not enclosed within any characters. The values should be the same as is the result of int.ToString() or float.ToString() method for invariant or English culture.

[C#]

dataView.RowFilter = "Year = 2008"          // integer value
dataView.RowFilter = "Price = 1199.9"       // float value

dataView.RowFilter = String.Format(CultureInfo.InvariantCulture.NumberFormat,
                     "Price = {0}", 1199.9f);

Date values are enclosed within sharp characters # #. The date format is the same as is the result of DateTime.ToString() method for invariant or English culture.

[C#]

dataView.RowFilter = "Date = #12/31/2008#"          // date value (time is 00:00:00)
dataView.RowFilter = "Date = #2008-12-31#"          // also this format is supported
dataView.RowFilter = "Date = #12/31/2008 16:44:58#" // date and time value

dataView.RowFilter = String.Format(CultureInfo.InvariantCulture.DateTimeFormat,
                     "Date = #{0}#", new DateTime(2008, 12, 31, 16, 44, 58));

Alternatively you can enclose all values within single quotes ' '. It means you can use string values for numbers or date time values. In this case the current culture is used to convert the string to the specific value.

[C#]

dataView.RowFilter = "Date = '12/31/2008 16:44:58'" // if current culture is English
dataView.RowFilter = "Date = '31.12.2008 16:44:58'" // if current culture is German

dataView.RowFilter = "Price = '1199.90'"            // if current culture is English
dataView.RowFilter = "Price = '1199,90'"            // if current culture is German

Comparison operators

Equal, not equal, less, greater operators are used to include only values that suit to a comparison expression. You can use these operators = <> < <= > >=.

Note: String comparison is culture-sensitive, it uses CultureInfo from DataTable.Localeproperty of related table (dataView.Table.Locale). If the property is not explicitly set, its default value is DataSet.Locale (and its default value is current system culture Thread.Curren­tThread.Curren tCulture).

[C#]

dataView.RowFilter = "Num = 10"             // number is equal to 10
dataView.RowFilter = "Date < #1/1/2008#"    // date is less than 1/1/2008
dataView.RowFilter = "Name <> 'John'"       // string is not equal to 'John'
dataView.RowFilter = "Name >= 'Jo'"         // string comparison

Operator IN is used to include only values from the list. You can use the operator for all data types, such as numbers or strings.

[C#]

dataView.RowFilter = "Id IN (1, 2, 3)"                    // integer values
dataView.RowFilter = "Price IN (1.0, 9.9, 11.5)"          // float values
dataView.RowFilter = "Name IN ('John', 'Jim', 'Tom')"     // string values
dataView.RowFilter = "Date IN (#12/31/2008#, #1/1/2009#)" // date time values

dataView.RowFilter = "Id NOT IN (1, 2, 3)"  // values not from the list

Operator LIKE is used to include only values that match a pattern with wildcards. Wildcardcharacter is * or %, it can be at the beginning of a pattern '*value', at the end 'value*', or at both '*value*'. Wildcard in the middle of a patern 'va*lue' is not allowed.

[C#]

dataView.RowFilter = "Name LIKE 'j*'"       // values that start with 'j'
dataView.RowFilter = "Name LIKE '%jo%'"     // values that contain 'jo'

dataView.RowFilter = "Name NOT LIKE 'j*'"   // values that don't start with 'j'

If a pattern in a LIKE clause contains any of these special characters * % [ ], those characters must be escaped in brackets [ ] like this [*], [%], [[] or []].

[C#]

dataView.RowFilter = "Name LIKE '[*]*'"     // values that starts with '*'
dataView.RowFilter = "Name LIKE '[[]*'"     // values that starts with '['

The following method escapes a text value for usage in a LIKE clause.

[C#]

public static string EscapeLikeValue(string valueWithoutWildcards)
{
  StringBuilder sb = new StringBuilder();
  for (int i = 0; i < valueWithoutWildcards.Length; i++)
  {
    char c = valueWithoutWildcards[i];
    if (c == '*' || c == '%' || c == '[' || c == ']')
      sb.Append("[").Append(c).Append("]");
    else if (c == '\'')
      sb.Append("''");
    else
      sb.Append(c);
  }
  return sb.ToString();
}

[C#]

// select all that starts with the value string (in this case with "*")
string value = "*";
// the dataView.RowFilter will be: "Name LIKE '[*]*'"
dataView.RowFilter = String.Format("Name LIKE '{0}*'", EscapeLikeValue(value));

Boolean operators

Boolean operators AND, OR and NOT are used to concatenate expressions. Operator NOT has precedence over AND operator and it has precedence over OR operator.

[C#]

// operator AND has precedence over OR operator, parenthesis are needed
dataView.RowFilter = "City = 'Tokyo' AND (Age < 20 OR Age > 60)";

// following examples do the same
dataView.RowFilter = "City <> 'Tokyo' AND City <> 'Paris'";
dataView.RowFilter = "NOT City = 'Tokyo' AND NOT City = 'Paris'";
dataView.RowFilter = "NOT (City = 'Tokyo' OR City = 'Paris')";
dataView.RowFilter = "City NOT IN ('Tokyo', 'Paris')";

Arithmetic and string operators

Arithmetic operators are addition +, subtraction -, multiplication *, division / and modulus %.

[C#]

dataView.RowFilter = "MotherAge - Age < 20";   // people with young mother
dataView.RowFilter = "Age % 10 = 0";           // people with decennial birthday

There is also one string operator concatenation +.

Parent-Child Relation Referencing

parent table can be referenced in an expression using parent column name with Parent.prefix. A column in a child table can be referenced using child column name with Child. prefix.

The reference to the child column must be in an aggregate function because child relationships may return multiple rows. For example expression SUM(Child.Price) returns sum of all prices in child table related to the row in parent table.

If a table has more than one child relation, the prefix must contain relation name. For example expression Child(OrdersToItemsRelation).Price references to column Price in child table using relation named OrdersToItemsRe lation.

Aggregate Functions

There are supported following aggregate functions SUM, COUNT, MIN, MAX, AVG (average), STDEV(statistical standard deviation) and VAR (statistical variance).

This example shows aggregate function performed on a single table.

[C#]

// select people with above-average salary
dataView.RowFilter = "Salary > AVG(Salary)";

Following example shows aggregate functions performed on two tables which have parent-child relation. Suppose there are tables Orders and Items with the parent-child relation.

[C#]

// select orders which have more than 5 items
dataView.RowFilter = "COUNT(Child.IdOrder) > 5";

// select orders which total price (sum of items prices) is greater or equal $500
dataView.RowFilter = "SUM(Child.Price) >= 500";

 


By  http://dotnet.fibo.us/?p=331

반응형
반응형

페이지 로딩시 시작할 스크립트 선언에 대해 <body onload="">의 onload를 많이 사용해 보았을 것입니다.

그리고 모든 페이지에서 공통으로 들어갈 스크립트는 페이지 마다 작성을 하지 않고, js 파일을 만들어 연결을 하여 사용을 할 것입니다.

 

여기서 그럼 모든 페이지에서 load시 공통으로 실행될 스크립트는 어떻게 작업을 할까요??

window.onload를 사용 하면 됩니다.

 

window.onload = function(){ 시작시 실행될 내용 }

이런식으로 말이죠.

 

그런데 문제는 window.onload와 <body onload="">는 동시에 사용을 할 수 없습니다.

<body onload="">가 실행이 되면 window.onload는 실행이 되지 않는 문제가 있습니다.

 

그래서 이를 해결하고자 할때 사용하는 것이

window::onload()입니다.

function window::onload(){ 시작시 실행될 내용 }

이렇게 사용을 하면 됩니다.

 

실행 순서는 <body onload="">가 먼저 실행되고, 이어서 window::onload()가 실행됩니다.

출처 카페 > arc-Hive | 없다
원문 http://cafe.naver.com/akadream/91

반응형
반응형

브라우저에 보이는 내용중에서 특정부분만 인쇄하기 위해서 
window.onbeforeprint 이벤트에서 출력 직전에 인쇄시 제외할 부분을 정의하고 
window.onafterprint 이벤트에서 출력 직후에 제외한 부분을 다시 나타나게 한다.

function printReceipt() {
    window.onbeforeprint  = function() {
      document.getElementById("btnPrint").style.display = "none";
    }

    window.onafterprint = function() {
      document.getElementById("btnPrint").style.display = "inline";
    }
   
    window.print();   
반응형
반응형

webtest 튜토리얼


 

 

Webtest XML을 이용해 작업을 스크립트한 다음 그 스크립트 내용대로 작업을 진행할 수 있는 web 자동화 테스트 툴이다.

기존 테스트를 수행하기 위해 개발자가 직접 수행한 반복적인 비 생산적 작업을 Webtest을 이용하면 쉽고 빠르게 테스트를 진행 할 수 있다.

 

 다음은 WebTest를 이용한 테스트 결과 화면이다.


 

사용자 삽입 이미지

그림 1 webtest의 테스트 결과 페이지

 

상기 화면은 단순히 페이지를 33번 연속으로 방문한 결과를 나타낸 페이지이다. 이렇게 canoo webtest는 작업 결과를 html화면으로 출력해 보다 쉽게 결과를 확인할 수 있게 도와준다.

 

 

 

설치

Canoo Webtest 설치 방법은 어렵지 않다. Webtest의 공식 홈페이지에 접속해 다운로드하면된다

.

사용자 삽입 이미지

그림 2 webtest 다운롣드 페이지

 

현재 가장 최신 버전은 2.6 이므로 2.6버전을 다운로드한다. Webtest에서 다운로드 받을 수 있는 압축파일은 크게 5개이다. build.zip, doc.zip, src.zip, selftest.war, build-maven.zip이 있는데 각 파일 이름별로 해당 패키지가 들어 있다. 우리는 우선 모든 파일을 포함하고 있는 Build.zip을 다운로드 하기로 한다.

 

다운로드된 파일의 압축을 풀고 webtest를 설치하고자 하는 디렉토리에 복사한다.

 

 

사용자 삽입 이미지

그림 3 webtest의 저장 경로

 

Webtest“Program Files” 밑에 설치 하는 것이 일반적이므로 압축을 푼뒤 디렉토리 이름을 webtest로 변경한 뒤 Program Files밑에 둔다.

 

다음은 환경변수 설정을 해야 한다.

내컴퓨터에서 마우스 오른쪽 버튼을 누르고 시스템 등록정보, 혹은 winkey + pause를 눌러 시스템 등록정보에 들어간뒤 고급탭에 있는 환경변수에 들어간다.


사용자 삽입 이미지

그림 4 시스템 등록 정보

 

 이곳에서 path에 다음과 같이 webtest 디렉토리에 포함된 bin디렉토리를 path 에 추가한다.

 

“C:\Program Files\WebTest\bin”

 

사용자 삽입 이미지

그림 5 환경변수 설정

 

환경 변수 설정이 끝났으면 커맨드라인에서 설치완료를 확인한다.

 

C:\> webtest –version

 

다음과 같이 버전정보가 출력되면 설치가 완료된 것이다.

 


사용자 삽입 이미지

그림 6 설치후 버젼 확인

 

Webtest의 예

 

Webtest의 실행을 위해서 우선 테스트 디렉토리를 하나 생성한다.

디렉토리를 하나 생성했으면 그 밑에 테스트 파일을 위핸 simpletest.xml파일을 생성한다.

 

사용자 삽입 이미지

그림 7 테스트 디렉토리

 

그 다음 테스트 스크립트를 작성한다.

 

<?xml version="1.0" encoding="euc-kr"?>

<project name="SimpleTest" basedir="." default="wt.full">

 

  <property name="webtest.home" location="C:\Program Files\WebTest" />

  <import file="${webtest.home}/webtest.xml"/>

 

  <target name="wt.testInWork">

             <webtest name="check that WebTest is FreeEnd's top 'bolg' result">

                           <invoke url="http://freeend.tistory.com/" description="FreeEnd Blog"/>

                           <verifyTitle text="FreeEnd" />

             </webtest>

  </target>

</project>


 

 

 

 우선 한글 사용을 위해 xml encoding형식을 euc-kr로 설정한다.

 

<?xml version="1.0" encoding="euc-kr"?>

 

 

 현재 테스트 프로젝트의 이름 등의 환경을 설정한다. Name은 이름 basedir은 작업 디렉토리이다.

 

<project name="SimpleTest" basedir="." default="wt.full">

 

 

 웹 테스트의 빌드를 위해 webtest에서 제공하는 webtest.xml파일을 import한다. 이 파일은 webtest를 설치한 디렉토리에 있으므로 location webtest_home 디렉토리를 설정해 주면 된다.

Property태그는 wettest,home의 프로퍼티를 설정해 주는 탭으로 webtest의 홈 디렉토리를 넣어준다.  이렇게 property를 설정해 두면 webtest의 홈 디렉토리를 webtest,home으로 대체하여 사용할 수 있다.

 

  <property name="webtest.home" location="C:\Program Files\WebTest" />

  <import file="${webtest.home}/webtest.xml"/>

 

 

실제로 이루어질 테스트의 한 step의 이름을 입력한다. 여기서는 FreeEnd Blog 라는 페이지를 대상으로 삼았으므로 그에 알맞은 테스트 이름을 입력하였다.

 

             <webtest name="check that WebTest is FreeEnd's top 'bolg' result">

 

 

다음으로 가장 중요한 실제 수행할 스크립트를 작성하는 부분이다. 이곳에서는 페이지를 요청하는 단순한 작업이므로 그에 해당하는 invoke 태그를 이용해 url을 입력한다. Description은 해당 요청사항에 대한 설명을 입력한다.

                           <invoke url="http://freeend.tistory.com/" description="FreeEnd Blog"/>

 

 

다음은 해당 요청 페이지가 정확하게 요청되어 원하는 페이지가 응답 되었는지를 확인하는 태그이다. verifyTitle 태그는 요청 페이지의 헤더 부분에 있는 title태그의 같을 가져와 자신의 태그에 있는 text값과 비교해 같으면 success, 다르면 fail을 리턴해 요청의 성공 실패를 확인시켜 준다.

 

                           <verifyTitle text="FreeEnd" />

 

 

 

실행

 

요청 스크립트의 작성이 끝나면 잘 저장한 후 실행 시킨다. 실행 명령어는 다음과 같다.

 

 

 C:\WebTestTest> webtest -buildfile simpletest.xml

 

 

다음은 요청된 스크립트의 실행 화면이다.

 

사용자 삽입 이미지

그림 8 실행중인 webtest의 콘솔화면

 

 

 

사용자 삽입 이미지

그림 9 테스트 모니터

 

테스트가 성공적으로 끝나면 windows에 설정된 default 브라우저로 결과같이 다음과 같이 출력된다.

 

사용자 삽입 이미지

그림 10 테스트 완료후 결과

 

 

 

 현재 위 테스트는 요청 페이지로의 요청에 대해 테스트 한 것이다. 이러한 테스트는 아주 기초적인 스크립트 작성으로 다양한 테그를 이용해 필드 채우기, 버튼클릭, 하이퍼링크 따라가기 등 많은 작업을 요청할 수 있다. 다른 요청 태그를 알고 싶다면 http://webtest.canoo.com/webtest/manual/stepIndex.html 를 방문하면 다양한 태그를 얻어 사용할 수 있다

반응형
반응형

1. 도메인 구입 : jaeya.kr (.kr 이벤트 중^^)
    - www.blueweb.co.kr

2. 무료 네임서버 설정 (개인 네임서버 구축 예정)
    - http://kr.dnserver.com

3. 티스토리 블로그 1차 포워딩 설정

우선 이렇게 설정만 하였다.!!
해외라 그런지 이것만 설정하는데 시간이 엄청 소비되네.ㅜㅜ

2차 계획 개인 웹서버(window) / 네임서버(Linux) 구축

                                                               참 아햏햏하죠~~

반응형
반응형

--Getdate()
Select Getdate()

--YYYY/MM/DD
Select Convert(varchar(10),Getdate(),111)

--YYYYMMDD
Select Convert(varchar(10),Getdate(),112)

--HH:MM:SS
Select Convert(varchar(8),Getdate(),108)

--HH:MM:SS:mmm
Select Convert(varchar(12),Getdate(),114)

--HHMMSS
Select Replace(Convert(varchar(8),Getdate(),108),':','')

--HHMMSSmmm
Select Replace(Convert(varchar(12),Getdate(),114),':','')

--YYYY/MM/DD HH:MM:SS
Select Replace(Convert(varchar(30),Getdate(),120),'-','/')

--YYYY/MM/DD HH:MM:SS
Select Replace(Convert(varchar(30),Getdate(),121),'-','/')

--YYYY/MM/DD HH:MM:SS
Select Convert(varchar(10),Getdate(),111) + Space(1) + Convert(varchar(8),Getdate(),108)

--YYYYMMDDHHMMSS
Select Convert(varchar(10),Getdate(),112) + Replace(Convert(varchar(8),Getdate(),108),':','')

반응형
반응형
뻥!! 뻥!! 뻥!!
반응형
반응형
SqlDataSource를 사용하지 않고 .cs에서 페이징으로 구성할때는
아래와 같이 PagePropertiesChanging 이벤트를 추가해줘야한다.

protected void Listview_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
{
     DataPager dp;
     dp = ((ListView)sender).FindControl("DataPager1") as DataPager;
     dp.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);

     ListView.DataSource = GetDataSet();
     ListView.DataBind();
}


GetDataSet()은 사용하시는 분의 취향에 따라 사용해주세용.~~
반응형

+ Recent posts