|
Answer» 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 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
|