- What is the difference between modal and modaless form in VB?
- Why we need a MDI form? How can we make a form as a mdichild form?
- Specify technical & functional architecture of your last 2 projects.
- What are the objects in ADODB?
- What are different types of cursors in ADODB?
- What are different types of locks in ADODB?
- What is disconnected recordset?
- Besides Standard Exe what are other types of projects in VB?
- What is the difference among Standard EXE, Active-X DLL, Active-X EXE?
- A standard exe contains a registered Active-X DLL. Now some error arise in the application but not in the standard exe , it is in the Active-X DLL. How do you find it out in which line no the error is?
- How can we find out that a recordset is blank (without using recordcount property)?
- What is the difference between procedure and functions in VB?
- What are the differences between stored procedure and functions in SQL Server 2000?
- I want to develop a stand alone application which can communicate with the existing applications in the system. On which this application should be based on: Standard Exe,Active-X Exe,Active-X Dll.
- can we call stored Procedure in Function in Sql Server 2000 and vice versa.
- What is an extended Stored Procedure?
- What is Trigger?
- Suppose I made an after Trigger on Delete. Now I fire Delete * From tablename. will this trigger work? Now do I fire truncate from table name (instead of delete command). will this trigger work now? If yes or no then why?
- What is a view? is View updatable?
- What is the difference between having and where clause?
- Why we need a group by clause?
- What is a join and their types?
- What is the difference between referencing and joining?
- What is the difference between constraints and triggers?
- What is the maximum size of form to hold the controls?
- Write the correct order of execution of following form’s events: initialization, Load, Activate, Refresh , Paint
- What is ACID Property of Transaction?
- How do we call MS- Excel in VB?
- What does option Explicit means?
- What is an index?
- What is normalization and its forms?
- What does Query_unload event do in VB? Why we need Form _unload event?
- What is a cursor in SQL Server 2000 and their types?
- How do we get month name in SQL Server 2000, Oracle, MS Access?
- How do we return a record set from a Stored Procedure in SQl server 2000?
- What are the magic tables in SQL Server 2000?
- What is Enum in VB?
- Write a query to find out emp names and their department names. if any emp has null in Deptid the it shows “No Departmentâ€Â.
- Write a query to find out those department names which has no employee.
- Write a query to find out those employees whose salary is greater than their department’s average salary.
- How do we get current date in SQL Server 2000, Oracle, MS Access?
There are 2 tables:
EMP : EmpId, Ename, Sal, DeptId
DEPT : DeptId, Dname
25 Comments on EDS Visual Basic and SQL Server interview questions
I have a Employee table, it consists empid,and 12 columns to store their monthly salary. Now i want to know the Max salary for an employee among the 12 months.
declare @tmp table
(
name varchar(10),
jan numeric,
feb numeric,
mar numeric,
apr numeric,
may numeric,
jun numeric,
jul numeric,
aug numeric,
sep numeric,
oct numeric,
nov numeric,
dec numeric
)
insert into @tmp values (’Milind’, 5000, 50000, 10000, 10000, 11000, 15000, 17000, 25000, 10000, 8955, 5468, 4000)
select * from @tmp
declare @salary table(month varchar(10), salary numeric )
insert into @salary select ‘jan’, jan from @tmp where name = ‘Milind’
insert into @salary select ‘feb’, feb from @tmp where name = ‘Milind’
insert into @salary select ‘mar’, mar from @tmp where name = ‘Milind’
insert into @salary select ‘apr’, apr from @tmp where name = ‘Milind’
insert into @salary select ‘may’, may from @tmp where name = ‘Milind’
insert into @salary select ‘jun’, jun from @tmp where name = ‘Milind’
insert into @salary select ‘jul’, jul from @tmp where name = ‘Milind’
insert into @salary select ‘aug’, aug from @tmp where name = ‘Milind’
insert into @salary select ’sep’, sep from @tmp where name = ‘Milind’
insert into @salary select ‘oct’, oct from @tmp where name = ‘Milind’
insert into @salary select ‘nov’, nov from @tmp where name = ‘Milind’
insert into @salary select ‘dec’, dec from @tmp where name = ‘Milind’
select month, salary from @salary where salary in (select Max(salary) salary from @salary)
1. What is the difference between modal and modaless form in VB?
A modal form or dialog box must be closed or hidden before you can continue working with the rest of the application.
Modeless forms let you shift the focus between the form and another form without having to close the initial form. The user can continue to work elsewhere in any application while the form is displayed.
‘ Visual Basic
Dim frmAbout as New Form()
‘ Display frmAbout as a modal dialog
frmAbout.ShowDialog()
‘ Visual Basic
Dim f As New Form()
‘ Display frmAbout as a modeless dialog.
f.Show()
2. Why we need a MDI form? How can we make a form as a mdichild form?
Multiple-document interface (MDI) applications allow you to display multiple documents at the same time, with each document displayed in its own window. MDI applications often have a Window menu item with submenus for switching between windows or documents.
‘ Visual Basic
Protected Sub MDIChildNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
Dim NewMDIChild As New Form2()
‘Set the Parent Form of the Child window.
NewMDIChild.MdiParent = Me
‘Display the new form.
NewMDIChild.Show()
End Sub
How do we call MS- Excel in VB?
Dim Ex1 As Object
Dim Ex2 As Object
‘open excel
Set Ex1 = CreateObject(”excel.sheet.8″)
Set Ex2 = Ex1.Application
Ex2.Workbooks.Open App.Path & “\xxxx\xxxx.xls”
Ex2.Cells(2, 1).Value = “xxxx”
Ex2.Cells(3, 1).Value = “abcde”
.
.
.
don’t forget to close
Ex2.ActiveWorkbook.Close 0
What is disconnected recordset?
Dim rs As New ADODB.Recordset
.
.
.
after finish
rs.close
CMIIW
#38
Create Table EMP (EmpId Int, Ename Varchar(10), Sal Money, DeptId Int)
Create Table DEPT ( DeptId Int, Dname Varchar(10))
Insert into Emp Select 1, ‘Test1′, 100, 101
Insert into Emp Select 2, ‘Test2′, 100, 102
Insert into Emp Select 3, ‘Test3′, 100, 103
Insert into Emp Select 4, ‘Test4′, 100, 104
Insert into dept Select 101, ‘DEPT1′
Insert into dept Select 102, ‘DEPT2′
Insert into dept Select 103, ‘DEPT3′
Insert into dept Select 104, ‘DEPT4′
Insert into dept Select 105, ‘DEPT5′
Select Ename, Case When Ename is NULL Then ‘Nodept’ Else DName End
from Dept Left outer join Emp
on Emp.deptid = Dept.Deptid
#41
How do we get current date in SQL Server 2000
Select Getdate()
# 39
Write a query to find out those department names which has no employee.
Select Dname from Dept A Where Not exists ( Select ‘x’ from Emp B Where A.Deptid = B.Deptid)
What are the magic tables in SQL Server 2000?
1 Inserted
2 Deleted
I have a Employee table, it consists empid,and 12 columns to store their monthly salary. Now i want to know the Max salary for an employee among the 12 months.
Another Option
—————
declare @tmp table
(
name varchar(10),
jan numeric,
feb numeric,
mar numeric,
apr numeric,
may numeric,
jun numeric,
jul numeric,
aug numeric,
sep numeric,
oct numeric,
nov numeric,
dec numeric
)
insert into @tmp values (’Milind’, 5000, 60000, 60000, 600000, 11000, 15000, 17000, 25000, 10000, 8955, 5468, 4000)
select * from @tmp
declare @salary table(month varchar(10), salary numeric )
insert into @salary select ‘jan’, jan from @tmp where name = ‘Milind’
insert into @salary select ‘feb’, feb from @tmp where name = ‘Milind’
insert into @salary select ‘mar’, mar from @tmp where name = ‘Milind’
insert into @salary select ‘apr’, apr from @tmp where name = ‘Milind’
insert into @salary select ‘may’, may from @tmp where name = ‘Milind’
insert into @salary select ‘jun’, jun from @tmp where name = ‘Milind’
insert into @salary select ‘jul’, jul from @tmp where name = ‘Milind’
insert into @salary select ‘aug’, aug from @tmp where name = ‘Milind’
insert into @salary select ’sep’, sep from @tmp where name = ‘Milind’
insert into @salary select ‘oct’, oct from @tmp where name = ‘Milind’
insert into @salary select ‘nov’, nov from @tmp where name = ‘Milind’
insert into @salary select ‘dec’, dec from @tmp where name = ‘Milind’
Select Month, Salary from @salary A Where 1= ( Select Count(*)+1 from @salary B Where A.Salary
#5.What are different types of cursors in ADODB?
Ans: Adopendynamic, adopenforwardonly, adopenkeyset, adopenstatic
#6. What are different types of locks in ADODB?
Ans: Adlockbatchoptimistic, adlockoptimistic, adlockpessimistic, adlockreadonly
Magic tables are create when you create trigger on the table. you will get it when your trigger getting fired.
following is the magic table…
1) Inserted - before value insert into actual table
2) Deleted - before value delete from actual table
3) Updated - before value update into actual table
Generally it is used for applying business logic before insert or delete or update.
example:
CREATE TRIGGER tri_DuplicatePolicy
ON dbo.tblLead
INSTEAD OF INSERT
AS
BEGIN
DECLARE @USERID VARCHAR(10)
SELECT @USERID = vUserId FROM INSERTED
IF EXISTS (SELECT vPOLICY_NO FROM TBLLEAD WHERE vPOLICY_NO = (SELECT vPOLICY_NO FROM INSERTED))
BEGIN
RAISERROR (’~~’, 16, 1)
RETURN
END
ELSE
BEGIN
INSERT INTO
tblLEAD(
[nRetention_No],
[vRenewal_Month],
[nRenewal_Year],
[vTitle],
[vInsuredName],
[vInsuredAdd1],
[vInsuredAdd2],
[vInsuredAdd3]
)
SELECT
[nRetention_No],
[vRenewal_Month],
[nRenewal_Year],
[vTitle],
[vInsuredName],
[vInsuredAdd1],
[vInsuredAdd2],
[vInsuredAdd3]
FROM
INSERTED
INSERT INTO tblSTATUSTRIAL(iSTATUSID, biLEADID, dtCREATEDDATE,vUserId)
VALUES(1, @@IDENTITY, GETDATE(), @USERID)
END
END
How to get month name in Oracle?
SQL> select to_char(sysdate,’MONTH’) from dual;
How to get month name in SQL Server 2000?
SELECT { fn MONTHNAME(GETDATE()) } AS Expr1
#18
DELETE * FROM tablename
This operation can be rolled back and will cause all DELETE triggers on the table to fire.
————————
TRUNCATE TABLE tablename
This operation cannot be rolled back and no triggers will be fired.
#15
In Stored Procedure you can call a User Define Function
But you can’t call a SP in a User Define function
#13
-functions always return one value but sp may or may not return .
-error handling can be done in sp, but not possible in functions.
-functions can be called from select statements, where clause and case but not possible in sp.
#24
http://blogs.techrepublic.com.com/programming-and-development/?p=402
Two tables are listed below
Table1 name: Employee
empid-> employeeId
EmpNmae->EmployeeName
Mgid -> ManagerId
column :Empid,Empname,Mgid
Table2 name : Salary
Idno->IDNUMBER
SalAmt ->SalaryAmount
column : idno,salamt
my question is finding the highest salary from the manager
Ex: A employee salary is 5000, him manager salary is 4000
let we show the these employee salaries are higher than the manager
please send me the query i tried out but i not get the successfull out put
Q.40.
select empid,ename from emp as e1 where salary>(select avg(sal) from emp as e2 where e1.code=e2.code)
Q.40
select empid,ename from emp as e1 where sal>(select avg(sal) from emp as e2 where e1.deptid=e2.deptid)
Q.39
select dname from dept where deptid not in (select deptid from emp)
How to get month name in Ms Access?
month(date)
Difference Between Delete And Truncate..
Delete is a DML Command. So it can be rolled back.
Truncate is a DDL Command. So it cannot be rolled back.
There can be where and condition with delete command. But in truncate we cannot.
Truncate delete all the rows from the table.
1. What is the difference between modal and modaless form in VB?
Modal form : Message Box, Input Box
Modless Form : Form1.frm
2. Why we need a MDI form? How can we make a form as a mdichild form?
To group all the form in one window.
Set Mdichild=true for any form.
3. Specify technical & functional architecture of your last 2 projects.
4. What are the objects in ADODB?
Connection, Recordset, Command
5. What are different types of cursors in ADODB?
AdopenDynamic, adopenstatic,adopenforwardonly,AdopenKeyset
6. What are different types of locks in ADODB?
adLockOptimistic,adLockBatchOptimistic,adLockReadOnly,adLockPesimesic
7. What is disconnected recordset?
A Recordset without a live connection to a database server is called a disconnected Recordset. You can create a disconnected Recordset using the CursorLocation Recordset object property. The CursorLocation property allows you to specify whether to use client or server cursors and, most importantly, allows changes to be made in a batch mode. This example demonstrates how to create a disconnected Recordset:
Public Function GetDisconnectedRecordset() as Object
Dim objConnection as New ADODB.Connection
Dim objRecordset as New ADODB.Recordset
objConnection.Open “DSN=MyDSN;UID=sa;PWD=;”
objRecordset.CursorLocation = adUseClient
objRecordset.Open “Select * From Authors”, objConnection, adOpenUnspecified, adLockUnspecified
Set GetDisconnectedRecordset = objRecordset
End Function
8. Besides Standard Exe what are other types of projects in VB?
Active x exe, Activex dll
9. What is the difference among Standard EXE, Active-X DLL, Active-X EXE?
Active X dll is in process while active x exe is out process.
10. A standard exe contains a registered Active-X DLL. Now some error arise in the application but not in the standard exe , it is in the Active-X DLL. How do you find it out in which line no the error is?
If we have code for active x dll then we can put debuger their otherwise puting msgbox we can do it.