Tuesday, December 8, 2009

Enable Login

SQL SERVER – Enable Login – Disable Login for specific user
In SQL SERVER 2005, all the login (including ’sa’ ) can be enabled and disabled using ALTER LOGIN command.

To disable ’sa’ login:
ALTER LOGIN sa DISABLE
GO

To enable ’sa’ login:
ALTER LOGIN sa ENABLE
GO

Also for additional security (prevent educated guess from hackers) the name of the ’sa’ account can be changed.
ALTER LOGIN [sa] WITH NAME = [AdminUser]
GO

SQL Connection Strings

SqlConnection conn = new SqlConnection("server=localhost; Initial Catalog=Northwind; User Id=sa;Password=sa;");

ID=userid
Passowrd=sql server password to login to that account
server=name/IP of the server you are trying to log in

Thursday, December 3, 2009

Result Set

What is Result Set?

An SQL result set is a set of rows from a database, as well as meta-information about the query such as the column names, and the types and sizes of each column. Depending on the database system, the number of rows in the result set may or may not be known. Usually, this number is not known up front because the result set is built on-the-fly. Precomputations often impose undesired performance impacts.

A result set is effectively a table. The ORDER BY clause can be used in a query to impose a certain sort condition on the rows. Without that clause, there is no guarantee whatsoever on the order in which the rows are returned.

On whole it has following features:
*The data in a ResultSet object is organized in rows and columns.
*A cursor (pointer) is also maintained in a ResultSet object to identify the current data row.
*A ResultSet object also contains ResultSet meta data which provides column definitions.
*ResultSet objects support 3 types of scrollabilities: TYPE_FORWARD_ONLY (default), TYPE_SCROLL_INSENSITIVE, and TYPE_SCROLL_SENSITIVE.
*ResultSet objects support 2 types of update capabilities: CONCUR_READ_ONLY (default) and CONCUR_UPDATABLE.
*ResultSet objects support 3 types of fetch direction hints: FETCH_FORWARD (default), FETCH_REVERSE, and FETCH_UNKNOWN.

Testing

Testing across diffrent languages

Its called Internationalisation testing i,e I18N. I18N is the term used for testing among different international languages .
Localisation testing is the term used for testing among various regional languages .

Localization- Tester can go to convert english to different languages.

Globalization/Internationalization-Tool can go to convert english to diffenrent languages.

Test Case

What is a test case? How to create a good test case?
Test cases are a sequence of steps to test the correct behavior of a functionality/feature of an application. A test case should have an input description, Test Sequence and an Expected Behavior. A test case is a list of the conditions or issues of what the tester want to test in software.
eg.
Test Sequence:
Sequence here is the order in which this step is to be executed. The test case document should be prepared in such a way that the test cases should follow a sequence.

Test Input Description:
1.Login to as administrator.
2. Go to Reports page
3. Click on the ‘Schedule reports' button
4. Add reports
5. Update

Expected Results:
The report schedule should get added to the report schedule table. Provisioning status of the reports should get handled

The objective of any Testing activity is to find the defects at the earliest stage. To test a product we must know

1. What all the features to be tested? (Objective of testing)
2. How to test the features? (Steps to test the objective)
3. What will be the result if I execute the steps given to test the features? (Expected behavior of the output for the objective)

So, a good test case should be more precise. And it should be more focus towards testing one particular functionality rather than covering all functionality.

Write testcase for print option using mswod?
  • in ms-word first check out the printer is connected properly
  • then check when we give print command its doesn't show any error.
  • if error shows then print is not working
  • first click on the print option and then ok
  • go to file option of ms-word and then click on print
  • also give print command by pressing the button ctrl+p then check out the pages to be printed

Temporary Tables

defines a table that is accessible only during the session in which it was created. It exists only for the duration of that session or until it is dropped with a DROP TABLE statement.

  • It is exclusive to the SQL session in which it is created; it is not visible outside of the session and does not share its data with other sessions.
  • It can be joined to any table in the database. Indexes and column default values can be defined for a temporary table and persist during the life of the table.
  • It can have the same name as a permanent table created during a later session, but not the same name as a permanent table created during the same or a prior session
  • Any queries submitted by the user of a temporary table are automatically queried against that table. This is true even if a permanent table with the same name exists or is subsequently created by a user in another session. Temporary tables always take precedence over permanent tables.
  • It does not have to be locked while it is being updated because other users cannot access the temporary table.
  • To avoid system table contention, it is not permanently cataloged in the system tables. Information about a temporary table resides in memory and appears in the system tables during the user's session but disappears when the session ends.
  • It is automatically dropped at the end of the SQL session; however, it can also be dropped during the session with the DROP TABLE statement.
CREATE TABLE #Emp ( EmpID int,EmpName char(30) )

You'll notice I prefixed the table with a pound sign (#). This tells SQL Server that this table is a local temporary table. This table is only visible to this session of SQL Server. When I close this session, the table will be automatically dropped. You can treat this table just like any other table with a few exceptions. The only real major one is that you can't have foreign key constraints on a temporary table

Temporary tables are created in tempdb. If you run this query:

select name from tempdb..sysobjects where name like '#Emp%'