Apigee Most Frequently Asked Latest VB.NET Interview Questions Answers
What Is The Difference Between Vb And Vb.net ?how To Insert Row By Row Data In Datagrid ? How To Work With Repeater Controls And Give Small Example Program ?
1.Visual Basic.NET is object oriented but VB 6 is not so.
2.Visual Basic.NET supports multi threading but VB doesnt support.
3.Visual basic.NET supports Managed Code extensions but VB doesnt support.
4.Both Vb and VB.NET support command line programs.
5.Both VB and VB.NET support COM and COM+ applications.
6.VB.NET is strongly typed but VB is not so.
Dim cn As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
Dim table As New DataTable
constructor
initialze the cn object like eg
cn = new
sqlconnection("server=name;database=name;uid=name;pwd=name;")
write it in the button .click event that add the table dynamicaaly created to datagrid
Try
cmd = New SqlCommand
cmd.CommandType = CommandType.Text
cmd.Connection = cn
cmd.CommandText = "select * from manas"
cn.Open()
dr = cmd.ExecuteReader()
Dim i As Integer
For i = 0 To dr.FieldCount - 1
table.Columns.Add(i)
Next
Dim row As DataRow
While dr.Read()
row = table.NewRow()
For i = 0 To dr.FieldCount - 1
row(i) = dr(i)
Next
table.Rows.Add(row)
End While
DataGrid1.DataSource = table
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
Finally
cn.Close()
dr.Close()
End Try
You Want That A Component Be Granted Full Access To The Active Directory Before It Is Loaded. Which Attributes Should You Use With The Component?name Some Of The Asp Components?
• Ad Rotator component – a way to manage advertisements on the web site.
• Content Linker component – a technique to direct users through a set of pag
How To Check For A Particular Record Whether It Is Present Or Not In Dataset
if the record is not present i want to display a message as no records what is the code for checking
if you are using "DataReader" then
if DataReaderName.HasRows then
statements
else
statements
end if
if you are using "DataSet" then
if DataSetName.TABLES.("tablename").ROWS.COUNT=0 THEN
statements.
end if
What Is The Advantage Of Packaging Over Xcopy In .net?
Xcopy technique is to simply copy your web application files to the production server hard drive and set a virtual directory there. The setting of a virtual directory is needed by several deployment schemes and can be achieved from Internet Information Manager Microsoft Management Consol.
It's always desirable to package your web applications such that they are easy to deploy on the production server then the traditional xcopy in which the developers have to use the command line.
What Is The Difference Between Datatable And Dataset?
Data table is a collection of record's that consist the single table Whenever dataset is collection of data table and it is provide interface between database and datatable 1 dataset consist multiple table.
What Is The Size Of .net Object?
Default size when a class gets loaded in memory is 8 bytes.
What Is The Significance Of Delegates. Where Should They Be Used? What Are The Situations Where We Require Them?
Delegates are used as pointer to hold the controls actually i used the delegates when there is problem in VB.Net 2005 where each control is already threaded, to use my personla thread on these control i used delegates
Ex
Private Delegate Sub dd()
Dim d1 As New dd(AddressOf c1)
Dim t1 As New Threading.Thread(AddressOf thread1)
public sub Thread1()
r1 =
Me.Label1.BeginInvoke(d1)
Me.Label1.EndInvoke(r1)
end sub
Public Sub c1()
Me.Label1.Text = ct1
Me.Label1.Refresh()
End Sub
What Make .net A Language Independent Platform Options Are: 1. Msil 2. Il 3. Clr 4. Jit
All options i.e MSIL/IL, JIT and CLR.
CLR(Common Language Runtime): CLR represents runtime environment of .Net which is responsible for executing .Net program on the production PC. It converts MSIL / IL code to native / machine understandable code by the help of its complier known as JIT. MSIL / IL(Microsoft Intermediate Language): .Net language compliers generates IL code which is managed code as it is managed by .Net (CLR).
JIT : Â .Net (CLR) compiler the complies IL code into machine code.
What Is The Difference Between Manifest And Metadata?
Manifest and metadata are 2 parts of assembly architecture.
Manifest is used for storing AssemblyName, AssemblyTitle,publicKey.
Metadata contains Namespaces, Classes.
I Was Asked In Interview That If I Have Created A Class And I Don't Want The Class To Be Inherited By Any Other Members Without Me Which Key Or Function I Have To Use?
VB: for class NotInheritable [MyClass]
For method: NotOverridable [MyMethod]
C# For class or method :sealed[MyClassMyMethod]{}
How To Store/retrive Images Into/from Oracle Database Using Vb.net ?
Code for storing Image
Dim rs As New ADODB.Recordset
Dim mstream As New ADODB.Stream
rs.Open "select * from StyleImage where
styleNo='" & TxtStyleNo.Text & "'", db,
adOpen Dynamic, adLock Optimistic
If rs.EOF = False Then
MsgBox "Stle Already Exist in Database"
Exit Sub
End If
db.Execute "exec
insertintostyleimage " & MCId & "," & SCId & ","
& GId & "," & CompanyId & ",'" &
TxtStyleNo & "','" & TxtStyleDesc
& "','" & TxtStyleCost & "','" &
Img1.Picture & "','" & Usercd & "','"
& Img2.Picture & "','" &
cmbexportername.Text & "','" &
txtexporterstyleno.Text & "'" rs.Open "select * from
StyleImage where styleNo='" & TxtStyleNo.Text & "'", db,
adOpenDynamic, adLockOptimistic
With rs
If .RecordCount <> 0 And Img1.Picture <>
LoadPicture("") And Img2.Picture <> LoadPicture("") Then
mstream.Type = adTypeBinary
mstream.Open
fpath = CD1.FileName
mstream.LoadFromFile fpath
.Fields("imagefilebig").Value = mstream.Read
fpath = CD2.FileName
mstream.LoadFromFile fpath
.Fields("imagefilesmall").Value = mstream.Read
.Update
mstream.Close
End If
.Close
End With
code for retriving images
Dim rscat As New ADODB.Recordset
Dim mstream As New ADODB.Stream
rscat.Open "select style image.*,
(select company name from exporter
where companyid=styleimage. exporterid)as expname
from styleimage where companyid=" & CompanyId & "
and maincatid=" & MCId & " and subcatid=" & SCId & "
and catgroupid=" & GId & " and styleno='" &
CmbStyleNo & "'", db, adOpenDynamic, adLockOptimistic
If rscat.RecordCount > 0 Then
mstream.Type = adTypeBinary
Set Img2.Picture = LoadPicture("")
If mstream.State = 1 Then mstream.Close
mstream.Open
If IsNull(rscat.Fields("Imagefilesmall")) Then
Else
mstream.Write rscat.Fields("Imagefilesmall").Value
If mstream.Size > 1 Then
mstream.SaveToFile App.Path & "temp.jpeg", adSaveCreateOverWrite
CD1.FileName = App.Path & "temp.jpeg"
Img2.Picture = LoadPicture(CD1.FileName)
mstream.Close
End If
End If
What Is The Difference Between Vb And Vb.net ?how To Insert Row By Row Data In Datagrid ? How To Work With Repeater Controls And Give Small Example Program ?
1.Visual Basic.NET is object oriented but VB 6 is not so.
2.Visual Basic.NET supports multi threading but VB doesnt support.
3.Visual basic.NET supports Managed Code extensions but VB doesnt support.
4.Both Vb and VB.NET support command line programs.
5.Both VB and VB.NET support COM and COM+ applications.
6.VB.NET is strongly typed but VB is not so.
Dim cn As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
Dim table As New DataTable
constructor
initialze the cn object like eg
cn = new
sqlconnection("server=name;database=name;uid=name;pwd=name;")
write it in the button .click event that add the table dynamicaaly created to datagrid
Try
cmd = New SqlCommand
cmd.CommandType = CommandType.Text
cmd.Connection = cn
cmd.CommandText = "select * from manas"
cn.Open()
dr = cmd.ExecuteReader()
Dim i As Integer
For i = 0 To dr.FieldCount - 1
table.Columns.Add(i)
Next
Dim row As DataRow
While dr.Read()
row = table.NewRow()
For i = 0 To dr.FieldCount - 1
row(i) = dr(i)
Next
table.Rows.Add(row)
End While
DataGrid1.DataSource = table
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
Finally
cn.Close()
dr.Close()
End Try
You Want That A Component Be Granted Full Access To The Active Directory Before It Is Loaded. Which Attributes Should You Use With The Component?name Some Of The Asp Components?
• Ad Rotator component – a way to manage advertisements on the web site.
• Content Linker component – a technique to direct users through a set of pag
Apigee Most Frequently Asked Latest VB.NET Interview Questions Answers |
How To Check For A Particular Record Whether It Is Present Or Not In Dataset
if the record is not present i want to display a message as no records what is the code for checking
if you are using "DataReader" then
if DataReaderName.HasRows then
statements
else
statements
end if
if you are using "DataSet" then
if DataSetName.TABLES.("tablename").ROWS.COUNT=0 THEN
statements.
end if
What Is The Advantage Of Packaging Over Xcopy In .net?
Xcopy technique is to simply copy your web application files to the production server hard drive and set a virtual directory there. The setting of a virtual directory is needed by several deployment schemes and can be achieved from Internet Information Manager Microsoft Management Consol.
It's always desirable to package your web applications such that they are easy to deploy on the production server then the traditional xcopy in which the developers have to use the command line.
What Is The Difference Between Datatable And Dataset?
Data table is a collection of record's that consist the single table Whenever dataset is collection of data table and it is provide interface between database and datatable 1 dataset consist multiple table.
What Is The Size Of .net Object?
Default size when a class gets loaded in memory is 8 bytes.
What Is The Significance Of Delegates. Where Should They Be Used? What Are The Situations Where We Require Them?
Delegates are used as pointer to hold the controls actually i used the delegates when there is problem in VB.Net 2005 where each control is already threaded, to use my personla thread on these control i used delegates
Ex
Private Delegate Sub dd()
Dim d1 As New dd(AddressOf c1)
Dim t1 As New Threading.Thread(AddressOf thread1)
public sub Thread1()
r1 =
Me.Label1.BeginInvoke(d1)
Me.Label1.EndInvoke(r1)
end sub
Public Sub c1()
Me.Label1.Text = ct1
Me.Label1.Refresh()
End Sub
What Make .net A Language Independent Platform Options Are: 1. Msil 2. Il 3. Clr 4. Jit
All options i.e MSIL/IL, JIT and CLR.
CLR(Common Language Runtime): CLR represents runtime environment of .Net which is responsible for executing .Net program on the production PC. It converts MSIL / IL code to native / machine understandable code by the help of its complier known as JIT. MSIL / IL(Microsoft Intermediate Language): .Net language compliers generates IL code which is managed code as it is managed by .Net (CLR).
JIT : Â .Net (CLR) compiler the complies IL code into machine code.
What Is The Difference Between Manifest And Metadata?
Manifest and metadata are 2 parts of assembly architecture.
Manifest is used for storing AssemblyName, AssemblyTitle,publicKey.
Metadata contains Namespaces, Classes.
I Was Asked In Interview That If I Have Created A Class And I Don't Want The Class To Be Inherited By Any Other Members Without Me Which Key Or Function I Have To Use?
VB: for class NotInheritable [MyClass]
For method: NotOverridable [MyMethod]
C# For class or method :sealed[MyClassMyMethod]{}
How To Store/retrive Images Into/from Oracle Database Using Vb.net ?
Code for storing Image
Dim rs As New ADODB.Recordset
Dim mstream As New ADODB.Stream
rs.Open "select * from StyleImage where
styleNo='" & TxtStyleNo.Text & "'", db,
adOpen Dynamic, adLock Optimistic
If rs.EOF = False Then
MsgBox "Stle Already Exist in Database"
Exit Sub
End If
db.Execute "exec
insertintostyleimage " & MCId & "," & SCId & ","
& GId & "," & CompanyId & ",'" &
TxtStyleNo & "','" & TxtStyleDesc
& "','" & TxtStyleCost & "','" &
Img1.Picture & "','" & Usercd & "','"
& Img2.Picture & "','" &
cmbexportername.Text & "','" &
txtexporterstyleno.Text & "'" rs.Open "select * from
StyleImage where styleNo='" & TxtStyleNo.Text & "'", db,
adOpenDynamic, adLockOptimistic
With rs
If .RecordCount <> 0 And Img1.Picture <>
LoadPicture("") And Img2.Picture <> LoadPicture("") Then
mstream.Type = adTypeBinary
mstream.Open
fpath = CD1.FileName
mstream.LoadFromFile fpath
.Fields("imagefilebig").Value = mstream.Read
fpath = CD2.FileName
mstream.LoadFromFile fpath
.Fields("imagefilesmall").Value = mstream.Read
.Update
mstream.Close
End If
.Close
End With
code for retriving images
Dim rscat As New ADODB.Recordset
Dim mstream As New ADODB.Stream
rscat.Open "select style image.*,
(select company name from exporter
where companyid=styleimage. exporterid)as expname
from styleimage where companyid=" & CompanyId & "
and maincatid=" & MCId & " and subcatid=" & SCId & "
and catgroupid=" & GId & " and styleno='" &
CmbStyleNo & "'", db, adOpenDynamic, adLockOptimistic
If rscat.RecordCount > 0 Then
mstream.Type = adTypeBinary
Set Img2.Picture = LoadPicture("")
If mstream.State = 1 Then mstream.Close
mstream.Open
If IsNull(rscat.Fields("Imagefilesmall")) Then
Else
mstream.Write rscat.Fields("Imagefilesmall").Value
If mstream.Size > 1 Then
mstream.SaveToFile App.Path & "temp.jpeg", adSaveCreateOverWrite
CD1.FileName = App.Path & "temp.jpeg"
Img2.Picture = LoadPicture(CD1.FileName)
mstream.Close
End If
End If
Post a Comment