Pages

Visual Basic 6 Method Using ADO and .NET Equivalent

                                                       

Visual Basic ADO and .NET

These are the two method of connecting database in visual basic 6 and .net equivalent

‘ Visual Basic 6 Method Using ADO See Code...............


Sub ExecuteSql( connStr As String, statement As String )

Dim conn as New ADODB.Connection

Dim rs as ADODB.RecordSet

conn.Open connStr

Set rs = conn.Execute( sqlStatement )

End Sub

‘ Visual Basic .NET Equivalent Method Using ADO.NET

Sub ExecuteSql( connStr As String, statement As String )

Dim conn as New OleDbConnection( connStr )

Dim cmd as New OleDbCommand( statement, conn )

conn.Open()

Dim dr As OleDbDataReader = cmd.ExecuteReader()

End Sub

0 comments:

Post a Comment