Tuesday, August 30, 2011

About Views

Which of the following statements is correct?

Ans1: CREATE VIEW dbo.vEmpSalTotal AS SELECT EmpId, SUM(EmpSal) FROM [Emp] GROUP BY EmpId
Ans2: CREATE VIEW dbo.vEmpSalTotal AS SELECT EmpId, SUM(EmpSal) as TotalSal FROM [Emp] GROUP BY EmpId
Ans3: The sp_HelpText system stored procedure reveals the code which created an object. For Example below code reveals the View text for the View : "viewGetDetails"

sp_HelpText viewGetDetails.

Ans4: You can Encrypt the view using the "WITH ENCRYPT" keyword in the Create View clause:

EmpID, SUM(EmpSal) AS TotalSalFROM [Emp]GROUP BY EmpID

Tips to keep updated in IT field.

Friday, August 26, 2011

update database using sqldataadapter

Following code demonstrates simple update to the database, using SqlDataAdapter

var nw = ConfigurationManager.ConnectionStrings["nw"];
var connection = new SqlConnection();
connection.ConnectionString = nw.ConnectionString;
var cmd = connection.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT * FROM Customers";
var da = new SqlDataAdapter(cmd);
var nwSet = new DataSet("nw");
var bldr = new SqlCommandBuilder(da);
da.Fill(nwSet, "Customers");
//Modify existing row
var customersTable = nwSet.Tables["Customers"];
var updRow = customersTable.Select("CustomerID='WOLZA'")[0];
updRow["CompanyName"] = "New Wolza Company";
//Add new row
"AAAAA", "Five A Company");
//Delete a row, note that you cannot delete a
//customer who has orders
var delRow = customersTable.Select("CustomerID='PARIS'")[0];
//send changes to database
da.Update(nwSet, "Customers");
dataGridView2.DataSource = nwSet;
dataGridView2.DataMember = "Customers";
MessageBox.Show("Update Complete");

Back up your data on Facebook,Linked In, Twitter by following simple steps

Back up your data on Facebook,Linked In, Twitter by following simple steps:

you can backup your data on facebook by going to Account at right top corner -> Account settings -> Click on link "Download a copy" above the facebook copyright ->Start my archive.

Export your Linked In contact by following these simple steps:

Go to Contacts Menu
My Connections
Click on Export Connections link at the bottom of the page.
You can select your choice to export to any of the file formats Microsoft Outlook
Outlook Express
Yahoo! Mail
Mac OS X Address Book (CSV file)
VCF file(vCard)
click on export

Back up you twitter data by using the services of any of the below sites: